/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0B1120;
  --card: #151F32;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --accent: #38BDF8;
  --accent-hover: #0EA5E9;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: #1E293B;
  --whatsapp: #25D366;
  --whatsapp-hover: #128C7E;
  --whatsapp-text: #0B1120;
  --focus: #38BDF8;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --container: 1200px;
  --header-h: 64px;
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-bg-grid,
  .hero-bg-glow,
  .btn-primary::after,
  .btn-whatsapp::after,
  .service-card,
  .project-card,
  .process-step,
  .tiktak-showcase,
  .tiktak-laptop,
  .tiktak-phone,
  .lang-switch {
    animation: none !important;
    transition: none !important;
  }
}
body {
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[lang="ar"] body { font-family: 'Cairo', 'Sora', system-ui, sans-serif; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; cursor: pointer; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.section-title { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; text-align: center; margin-bottom: 2.5rem; color: var(--text); }

/* Hero Background */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 40%, transparent 85%);
  animation: gridFade 20s ease-in-out infinite alternate;
}
@keyframes gridFade {
  0% { opacity: 0.4; transform: translate(0, 0); }
  100% { opacity: 0.6; transform: translate(20px, 20px); }
}
.hero-bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 30% 30%, rgba(37, 99, 235, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 70% 60%, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
  animation: glowFloat 30s ease-in-out infinite alternate;
}
@keyframes glowFloat {
  0% { transform: translate(-2%, -2%) scale(1); opacity: 0.7; }
  100% { transform: translate(2%, 2%) scale(1.05); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-bg-grid,
  .hero-bg-glow {
    animation: none;
  }
}

/* Header */
.header { position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); background: rgba(11, 17, 32, 0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 1rem; }
.logo { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.logo-icon { width: 36px; height: 36px; flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; gap: 0.15rem; }
.logo-name { font-size: 1.125rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.logo-subtitle { font-size: 0.625rem; font-weight: 500; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.3; }
html[lang="ar"] .logo-name { font-family: 'Cairo', 'Sora', system-ui, sans-serif; line-height: 1.5; }
html[lang="ar"] .logo-subtitle { letter-spacing: 0.05em; }
.nav { flex: 1; display: flex; justify-content: flex-end; }
.nav-menu { display: flex; gap: 0.5rem; align-items: center; }
.nav-link { padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-weight: 500; color: var(--text-muted); transition: color var(--transition), background var(--transition); white-space: nowrap; }
.nav-link:hover, .nav-link:focus { color: var(--text); background: var(--card); }
.nav-toggle { display: none; }
.hamburger { display: block; width: 24px; height: 2px; background: var(--text); position: relative; }
.hamburger::before, .hamburger::after { content: ''; position: absolute; left: 0; width: 100%; height: 2px; background: var(--text); transition: transform var(--transition); }
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.lang-switch { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.75rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.875rem; color: var(--text); transition: border-color var(--transition), background var(--transition); }
.lang-switch:hover { border-color: var(--accent); background: var(--border); }
.lang-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lang-label { display: inline-block; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.5rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9375rem; transition: background var(--transition), transform var(--transition), box-shadow var(--transition); white-space: nowrap; position: relative; overflow: hidden; }
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); }
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%); color: #fff; box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3); }
.btn-primary::after { content: '→'; display: inline-block; transition: transform var(--transition); font-size: 1.2em; line-height: 1; }
.btn-primary:hover::after { transform: translateX(4px); }
html[dir="rtl"] .btn-primary::after { content: '←'; transform: translateX(-4px); }
html[dir="rtl"] .btn-primary:hover::after { transform: translateX(0); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--accent); box-shadow: none; }
.btn-secondary:hover { border-color: var(--accent-hover); background: rgba(56, 189, 248, 0.15); color: var(--text); }
.btn-secondary:focus-visible { outline-color: var(--focus); outline-offset: 2px; border-color: var(--accent-hover); }
.btn-whatsapp { background: var(--whatsapp); color: var(--whatsapp-text); box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3); }
.btn-whatsapp:hover { background: var(--whatsapp-hover); box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4); }
.btn-whatsapp:focus-visible { outline-color: var(--whatsapp); }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn .whatsapp-icon { flex-shrink: 0; }
.header-whatsapp { display: none; }
.header-whatsapp span { display: none; }

/* Hero */
.hero { position: relative; display: flex; align-items: center; padding: calc(var(--header-h) + 3rem) 1.5rem 3rem; }
.hero .container { position: relative; z-index: 1; width: 100%; }
.hero-content { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; }
.hero-text { text-align: center; }
.hero-title { font-size: clamp(1.5rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.2; margin-bottom: 1.25rem; color: var(--text); }
.hero-title .highlight { color: var(--accent); }
.hero-desc { font-size: clamp(1rem, 2.5vw, 1.125rem); color: var(--text-muted); max-width: 60ch; margin: 0 auto 1rem; }
.hero-cta { font-size: clamp(0.9375rem, 2vw, 1rem); color: var(--accent); font-weight: 500; margin-bottom: 2rem; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.tiktak-showcase { display: flex; position: relative; justify-content: center; align-items: flex-start; cursor: pointer; width: 100%; max-width: 520px; margin: 0 auto; }
.tiktak-showcase:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 12px; }
@media (hover: hover) {
  .tiktak-showcase:hover .tiktak-laptop-frame { border-color: var(--accent); box-shadow: 0 24px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 2px var(--accent); }
  .tiktak-showcase:hover .tiktak-phone-frame { border-color: var(--accent); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 2px var(--accent); }
}
.tiktak-laptop { position: relative; width: 100%; max-width: 520px; aspect-ratio: 16/9; }
.tiktak-laptop-frame { position: absolute; inset: 0; border-radius: 16px 16px 4px 4px; background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%); border: 2px solid #334155; box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05); }
.tiktak-laptop-frame::before { content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 80px; height: 4px; background: #1e293b; border-radius: 2px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); }
.tiktak-laptop-frame::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 120px; height: 8px; background: linear-gradient(145deg, #334155 0%, #1e293b 100%); border-radius: 0 0 60px 60px; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.tiktak-laptop-screen { position: absolute; top: 16px; left: 16px; right: 16px; bottom: 16px; border-radius: 8px; overflow: hidden; background: #0b1120; }
.tiktak-laptop-screen img { width: 100%; height: auto; display: block; }
.tiktak-phone { position: absolute; bottom: -30px; right: -14px; width: 26%; max-width: 130px; min-width: 80px; aspect-ratio: 9/16; z-index: 2; filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5)); }
.tiktak-phone-frame { position: absolute; inset: 0; border-radius: 24px; background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%); border: 2px solid #334155; box-shadow: inset 0 1px 0 rgba(255,255,255,0.05); }
.tiktak-phone-frame::before { content: ''; position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 60px; height: 4px; background: #1e293b; border-radius: 2px; }
.tiktak-phone-frame::after { content: ''; position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: 24px; height: 4px; background: #334155; border-radius: 2px; }
.tiktak-phone-screen { position: absolute; top: 22px; left: 8px; right: 8px; bottom: 22px; border-radius: 16px; overflow: hidden; background: #0b1120; }
.tiktak-phone-screen img { width: 100%; height: auto; display: block; }
@media (min-width: 900px) {
  .hero { padding-top: calc(var(--header-h) + 4rem); padding-bottom: 4rem; }
  .hero-content { grid-template-columns: 1fr 1fr; }
  .hero-text { text-align: left; }
  .hero-desc { margin-left: 0; margin-right: 0; }
  .hero-buttons { justify-content: flex-start; }
  html[dir="rtl"] .hero-content { grid-template-columns: 1fr 1fr; }
  html[dir="rtl"] .hero-text { text-align: right; }
  html[dir="rtl"] .hero-buttons { justify-content: flex-end; }
}
@media (max-width: 899px) {
  .hero { padding-top: calc(var(--header-h) + 1.5rem); padding-bottom: 2.5rem; }
  .hero-text { text-align: center; }
}

/* Services */
.services { padding: 5rem 1.5rem; background: linear-gradient(180deg, transparent 0%, var(--card) 100%); }
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.service-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition); }
.service-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.service-icon { display: inline-flex; color: var(--accent); margin-bottom: 1rem; }
.service-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--text); }
.service-desc { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.7; }

/* Projects */
.projects { padding: 5rem 1.5rem; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.project-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color var(--transition), box-shadow var(--transition); max-width: 900px; margin: 0 auto; }
.project-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.project-thumb { aspect-ratio: 16/9; background: var(--border); overflow: hidden; cursor: pointer; }
.project-thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.project-thumb img { width: 100%; height: auto; display: block; transform-origin: top center; transition: transform 0.4s ease; }
.project-card:hover .project-thumb img { transform: scale(1.05); }
.project-content { padding: 1.5rem; display: flex; flex-direction: column; flex: 1; }
.project-type { font-size: 0.75rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.project-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text); }
.project-desc { color: var(--text-muted); font-size: 0.875rem; line-height: 1.6; margin-bottom: 1.25rem; flex: 1; }
.project-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.project-gallery-btn { flex: 1; min-width: 140px; }
.project-link { flex: 1; min-width: 140px; text-align: center; }

/* Process */
.process { padding: 5rem 1.5rem; background: linear-gradient(180deg, transparent 0%, var(--card) 100%); }
.process-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.process-step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; position: relative; text-align: center; transition: border-color var(--transition); }
.process-step:hover { border-color: var(--accent); }
.step-number { display: inline-block; font-size: 0.75rem; font-weight: 700; color: var(--accent); background: rgba(56, 189, 248, 0.1); padding: 0.25rem 0.75rem; border-radius: 100px; margin-bottom: 1rem; }
.step-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.step-desc { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.6; }

/* Contact */
.contact { padding: 5rem 1.5rem; text-align: center; }
.contact-desc { font-size: clamp(1rem, 2.5vw, 1.125rem); color: var(--text-muted); max-width: 60ch; margin: 0 auto 2rem; }

/* Footer */
.footer { background: var(--card); border-top: 1px solid var(--border); padding: 2rem 1.5rem; margin-top: auto; }
.footer-text { text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* Gallery Modal */
.gallery-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 0; outline: none; }
.gallery-modal[hidden] { display: none; }
.gallery-modal-overlay { position: absolute; inset: 0; background: #050810; }
.gallery-modal-content { position: relative; width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: #050810; }
.gallery-topbar { position: relative; display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 0.75rem 1rem; flex-shrink: 0; }
.gallery-close { position: absolute; top: 50%; left: 1rem; transform: translateY(-50%); width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--card); border: 1px solid var(--border); color: var(--text); }
html[dir="rtl"] .gallery-close { left: auto; right: 1rem; }
.gallery-close:hover { background: var(--border); border-color: var(--accent); }
.gallery-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gallery-tabs { display: flex; justify-content: center; gap: 0.5rem; flex-shrink: 0; margin: 0 auto; }
.gallery-tab { padding: 0.5rem 0.875rem; border-radius: var(--radius-sm); border: 1px solid transparent; background: rgba(255,255,255,0.06); color: var(--text-muted); font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.gallery-tab:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.gallery-tab[aria-selected="true"] { background: var(--accent); color: #0B1120; border-color: var(--accent); }
.gallery-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gallery-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #050810; overflow: hidden; }
#gallery-image { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-bottombar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; padding: 0.75rem 1rem; flex-shrink: 0; }
.gallery-caption { flex: 1 0 100%; color: var(--text-muted); font-size: 0.9375rem; text-align: center; overflow-wrap: break-word; }
.gallery-nav { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--card); border: 1px solid var(--border); color: var(--text); flex-shrink: 0; }
.gallery-nav svg { width: 24px; height: 24px; display: block; }
.gallery-nav:hover { background: var(--border); border-color: var(--accent); }
.gallery-nav:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gallery-counter { font-size: 0.875rem; color: var(--text-muted); }

/* Responsive */
@media (max-width: 899px) {
  .nav-toggle { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; padding: 0; }
  .nav { flex: 0 0 auto; }
  .nav-menu { position: fixed; top: var(--header-h); left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 1rem; gap: 0.5rem; max-height: calc(100vh - var(--header-h)); overflow-y: auto; transform: translateY(-100%); opacity: 0; visibility: hidden; transition: transform var(--transition), opacity var(--transition), visibility var(--transition); }
  .nav-menu.open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav-menu > li { width: 100%; }
  .nav-link { display: block; width: 100%; text-align: start; padding: 1rem 1.25rem; font-size: 1.0625rem; }
  .nav-whatsapp-item { display: block; margin-top: 0.5rem; }
  .nav-whatsapp-item[hidden] { display: none; }
  .nav-whatsapp-item .btn-whatsapp { width: 100%; justify-content: center; padding: 1rem 1.25rem; }
}
@media (max-width: 768px) {
  .hero { padding-top: calc(var(--header-h) + 2rem); }
}
@media (max-width: 480px) {
  .btn { padding: 0.75rem 1.25rem; }
  .project-actions { flex-direction: column; }
  .project-gallery-btn, .project-link { width: 100%; }
  .gallery-topbar { gap: 0.5rem; padding: 0.625rem 0.75rem; }
  .gallery-tabs { gap: 0.375rem; }
  .gallery-tab { padding: 0.4rem 0.6rem; font-size: 0.8125rem; }
}
@media (max-width: 360px) {
  .gallery-topbar { flex-direction: column; gap: 0.5rem; }
  .gallery-close { position: static; transform: none; align-self: flex-start; }
  html[dir="rtl"] .gallery-close { align-self: flex-end; }
}

/* RTL adjustments */
@media (min-width: 900px) {
  html[dir="rtl"] .nav-menu { flex-direction: row-reverse; }
}
html[dir="rtl"] .hero-buttons { flex-direction: row-reverse; }
html[dir="rtl"] .project-actions { flex-direction: row-reverse; }
html[dir="rtl"] .nav-link { text-align: start; }

/* Print */
@media print { .header, .hero-buttons, .btn, .gallery-modal { display: none !important; } .hero { min-height: auto; padding-top: 2rem; } }