:root {
  --bg: #050816;
  --bg-2: #0d1226;
  --panel: rgba(13, 18, 38, 0.66);
  --panel-strong: rgba(13, 18, 38, 0.88);
  --text: #ffffff;
  --muted: #bfc7d5;
  --line: rgba(255, 255, 255, 0.1);
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --green: #5eead4;
  --font-en: "Montserrat", system-ui, sans-serif;
  --font-ar: "Cairo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 18%, rgba(34, 211, 238, 0.14), transparent 30rem),
    radial-gradient(circle at 78% 8%, rgba(139, 92, 246, 0.18), transparent 34rem),
    linear-gradient(135deg, var(--bg), #080b1e 48%, #030613);
  font-family: var(--font-en);
  overflow-x: hidden;
}
body[dir="rtl"] { font-family: var(--font-ar); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }

.progress {
  position: fixed;
  inset: 0 auto auto 0;
  width: 0%;
  height: 3px;
  z-index: 50;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--violet));
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.7);
}

.cursor-glow {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.18;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(34, 211, 238, 0.55), transparent 68%);
  mix-blend-mode: screen;
}

#network {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.42;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 45%, rgba(59, 130, 246, 0.08) 48%, transparent 52% 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.024) 0 1px, transparent 1px 92px);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 82%);
}

.site-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, calc(100% - 32px));
  height: 76px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 8, 22, 0.72);
  backdrop-filter: blur(18px);
}

.brand, .nav-links, .hero-actions, .socials, .hero-metrics {
  display: flex;
  align-items: center;
}
.brand { gap: 0.75rem; font-weight: 800; }
.brand span {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--cyan) 52%, var(--violet));
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.34);
}
.nav-links { gap: 1.5rem; color: var(--muted); font-size: 0.92rem; }
.nav-links a { transition: color 0.25s ease; }
.nav-links a:hover { color: var(--text); }
.language-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.055);
  min-height: 42px;
  padding: 0 1rem;
  cursor: pointer;
}

.section {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  padding: 92px 0;
}

.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: start;
  gap: clamp(2rem, 5vw, 5rem);
  padding-top: 126px;
  padding-bottom: 52px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
body[dir="rtl"] .eyebrow { text-transform: none; }
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin: 1rem 0 1.2rem;
  font-size: clamp(2.05rem, 4.8vw, 4.65rem);
  line-height: 1.04;
  letter-spacing: 0;
  max-width: 820px;
}
h2 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0;
  margin-bottom: 1rem;
}
h3 { font-size: 1.08rem; margin-bottom: 0.65rem; }
p { color: var(--muted); line-height: 1.8; }
.lead { font-size: clamp(1rem, 1.4vw, 1.18rem); max-width: 680px; }

.hero-actions { gap: 0.85rem; flex-wrap: wrap; margin: 2rem 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.18rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--text);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.btn.primary {
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--cyan) 48%, var(--violet));
  box-shadow: 0 14px 44px rgba(59, 130, 246, 0.34);
}
.btn.ghost { background: rgba(255,255,255,0.055); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 18px 52px rgba(34, 211, 238, 0.2); }

.hero-metrics {
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-metrics span, .stat {
  min-width: 150px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
}
.hero-metrics strong, .stat strong {
  display: block;
  font-size: 1.75rem;
}
.hero-metrics small, .stat span { color: var(--muted); }

.hero-portrait {
  position: relative;
  min-height: min(78vh, 760px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  align-self: start;
  padding-top: 2.85rem;
  isolation: isolate;
  animation: float 6s ease-in-out infinite;
}
.portrait-glow {
  position: absolute;
  width: 82%;
  height: 70%;
  bottom: 5%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(34, 211, 238, 0.32), transparent 64%),
    radial-gradient(circle at 70% 30%, rgba(139, 92, 246, 0.32), transparent 58%);
  filter: blur(26px);
  z-index: -1;
}
.hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 56% 40%, transparent 0 31%, rgba(5,8,22,0.36) 51%, rgba(5,8,22,0.98) 78%),
    linear-gradient(to bottom, rgba(5,8,22,1) 0%, rgba(5,8,22,0.5) 12%, transparent 28%, transparent 66%, rgba(5,8,22,1) 100%),
    linear-gradient(to right, rgba(5,8,22,1) 0%, rgba(5,8,22,0.42) 16%, transparent 31%, transparent 70%, rgba(5,8,22,1) 100%);
  mix-blend-mode: normal;
}
.hero-portrait img {
  width: min(112%, 650px);
  max-height: 82vh;
  object-fit: contain;
  object-position: top center;
  filter: saturate(0.92) contrast(1.04) drop-shadow(0 32px 58px rgba(0, 0, 0, 0.48));
  -webkit-mask-image:
    radial-gradient(ellipse at 56% 40%, #000 0 33%, rgba(0,0,0,0.84) 48%, rgba(0,0,0,0.32) 63%, transparent 77%),
    linear-gradient(to bottom, transparent 0%, #000 13%, #000 70%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    radial-gradient(ellipse at 56% 40%, #000 0 33%, rgba(0,0,0,0.84) 48%, rgba(0,0,0,0.32) 63%, transparent 77%),
    linear-gradient(to bottom, transparent 0%, #000 13%, #000 70%, transparent 100%);
  mask-composite: intersect;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 2.2rem;
}
.section-heading p { font-size: 1.04rem; }

.glass, .project-card, .gallery-card, .ai-card, .timeline-item, .testimonial, .contact-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);
}
.role-grid, .service-grid, .ai-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.glass, .ai-card, .timeline-item { padding: 1.25rem; }
.glass svg, .service svg, .ai-card svg {
  color: var(--cyan);
  width: 28px;
  height: 28px;
  margin-bottom: 1rem;
}
.glass i[data-icon], .service i[data-icon], .ai-card i[data-icon] {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 1rem;
}
.glass i[data-icon]::before, .service i[data-icon]::before, .ai-card i[data-icon]::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 20px rgba(34,211,238,0.28);
}

.skill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.skill {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--muted);
  background: rgba(255,255,255,0.055);
  transition: transform 0.25s ease, color 0.25s ease, background 0.25s ease;
}
.skill:hover { color: var(--text); background: rgba(34,211,238,0.12); transform: translateY(-4px); }

.service {
  min-height: 176px;
  padding: 1.1rem;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025)),
    var(--panel);
  border: 1px solid var(--line);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}
.project-card {
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.18s ease, border-color 0.25s ease;
}
.project-card:hover { border-color: rgba(34, 211, 238, 0.4); }
.mock-image, .gallery-card img, .screenshot img, .ai-project img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #0d1226;
}
.real-project-image {
  padding: 1rem;
  background:
    radial-gradient(circle at 26% 18%, rgba(34,211,238,0.18), transparent 34%),
    linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    #060a18;
}
.phone-showcase {
  width: min(52%, 190px);
  aspect-ratio: 9 / 19.5;
  margin-inline: auto;
  border-radius: 24px;
  padding: 7px;
  background: linear-gradient(145deg, rgba(255,255,255,0.28), rgba(255,255,255,0.06));
  box-shadow: 0 24px 70px rgba(0,0,0,0.45), 0 0 48px rgba(34,211,238,0.14);
}
.phone-showcase img {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  object-fit: cover;
  object-position: top center;
}
.project-body { padding: 1.1rem; }
.stack { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0; }
.stack span {
  color: var(--cyan);
  font-size: 0.76rem;
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  background: rgba(34,211,238,0.07);
}
.card-actions { display: flex; gap: 0.6rem; }
.card-actions a {
  flex: 1;
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 1px solid var(--line);
}

.ai-panel {
  position: relative;
  min-height: 360px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  align-items: center;
  padding: clamp(1.4rem, 4vw, 3rem);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 40%, rgba(34,211,238,0.28), transparent 32%),
    linear-gradient(135deg, rgba(59,130,246,0.24), rgba(139,92,246,0.16)),
    rgba(13,18,38,0.72);
  border: 1px solid var(--line);
}
.ai-orbit {
  position: relative;
  aspect-ratio: 1;
  max-width: 340px;
  width: 100%;
  margin-inline: auto;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  animation: spin 18s linear infinite;
}
.ai-orbit::before, .ai-orbit::after {
  content: "";
  position: absolute;
  inset: 16%;
  border: 1px solid rgba(34,211,238,0.18);
  border-radius: 50%;
}
.ai-orbit span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 78px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(5,8,22,0.72);
  border: 1px solid rgba(34,211,238,0.25);
  color: var(--cyan);
  font-weight: 800;
  box-shadow: 0 0 32px rgba(34,211,238,0.2);
}
.ai-orbit span:nth-child(1) { top: -18px; left: 50%; transform: translateX(-50%); }
.ai-orbit span:nth-child(2) { right: -18px; top: 50%; transform: translateY(-50%); }
.ai-orbit span:nth-child(3) { bottom: -18px; left: 50%; transform: translateX(-50%); }
.ai-orbit span:nth-child(4) { left: -18px; top: 50%; transform: translateY(-50%); }
.ai-grid { margin-top: 1rem; }

.masonry {
  columns: 3 260px;
  column-gap: 1rem;
}
.gallery-card {
  break-inside: avoid;
  overflow: hidden;
  margin-bottom: 1rem;
}
.gallery-card img { aspect-ratio: var(--ratio, 4 / 3); transition: transform 0.45s ease; }
.gallery-card:hover img { transform: scale(1.06); }
.gallery-card h3 { padding: 0.9rem 1rem 1rem; margin: 0; }

.screenshot-grid, .ai-projects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.screenshot, .ai-project { cursor: zoom-in; }
.screenshot img, .ai-project img { border-radius: 8px; border: 1px solid var(--line); }
.screenshot h3, .ai-project h3 { margin: 0.85rem 0 0; }
.screenshot.real {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.045);
}
.screenshot.real img {
  width: min(72%, 260px);
  height: 420px;
  margin-inline: auto;
  border-radius: 22px;
  object-fit: cover;
  object-position: top center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.38);
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 1rem;
  max-width: 880px;
}
.timeline-list::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18px;
  width: 1px;
  background: linear-gradient(var(--cyan), var(--violet));
}
body[dir="rtl"] .timeline-list::before { left: auto; right: 18px; }
.timeline-item {
  position: relative;
  margin-left: 52px;
}
body[dir="rtl"] .timeline-item { margin-left: 0; margin-right: 52px; }
.timeline-item::before {
  content: "";
  position: absolute;
  top: 22px;
  left: -43px;
  width: 18px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 24px var(--cyan);
}
body[dir="rtl"] .timeline-item::before { left: auto; right: -43px; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  text-align: center;
}
.stat { min-width: 0; }
.stat strong { font-size: clamp(2rem, 4vw, 3.5rem); }

.testimonial-slider {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.testimonial { padding: 1.35rem; }
.testimonial strong { display: block; margin-top: 1rem; color: var(--cyan); }

.contact {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 2rem;
  align-items: start;
}
.socials { gap: 0.7rem; margin-top: 1.4rem; }
.socials a {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.055);
}
.contact-form {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
}
label { display: grid; gap: 0.45rem; color: var(--muted); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.055);
  padding: 0.9rem 1rem;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: rgba(34,211,238,0.55); }
select option { background: #0d1226; }

.footer {
  position: relative;
  z-index: 2;
  padding: 2.2rem 1rem;
  text-align: center;
  border-top: 1px solid var(--line);
  background: rgba(5,8,22,0.6);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-links a:hover, .form-legal a:hover { color: var(--cyan); }
.form-legal { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.form-legal a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 2rem;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(14px);
}
.lightbox.open { display: grid; }
.lightbox img {
  max-height: 82vh;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 32px 100px rgba(0,0,0,0.55);
}
.lightbox button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 46px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  font-size: 1.8rem;
}

.reveal { opacity: 0; transform: translateY(28px); filter: blur(10px); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .nav-links { display: none; }
  .hero, .contact, .ai-panel { grid-template-columns: 1fr; }
  .hero { padding-top: 116px; text-align: center; }
  .hero-copy { display: grid; justify-items: center; }
  .hero-portrait { min-height: 520px; order: -1; }
  .role-grid, .service-grid, .ai-grid, .project-grid, .screenshot-grid, .ai-projects, .testimonial-slider, .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header { width: calc(100% - 20px); height: 64px; margin-top: 8px; }
  .brand strong { display: none; }
  .section { width: min(100% - 24px, 1180px); padding: 68px 0; }
  h1 { font-size: clamp(1.95rem, 10.5vw, 3.1rem); }
  .hero { min-height: auto; padding-top: 90px; }
  .hero-portrait { min-height: 350px; padding-top: 0.9rem; }
  .hero-portrait img { max-height: 390px; width: min(116%, 430px); }
  .role-grid, .service-grid, .ai-grid, .project-grid, .screenshot-grid, .ai-projects, .testimonial-slider, .stats {
    grid-template-columns: 1fr;
  }
  .hero-metrics span { min-width: calc(50% - 0.5rem); }
  .cursor-glow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; filter: none; }
}
