/* ============================================================
   Devitopia - Bold dev-agency landing
   Pure CSS, no framework. Dark, vibrant red accent (#FF4757).
   ============================================================ */

/* ---------- Local webfont: Stagnan (Latin display + body) ----------
   Weights: 400 / 500 / 600 / 700. `font-display: swap` prevents FOIT
   and keeps LCP fast. Consider converting .otf -> .woff2 for ~60%
   smaller files and much better decoding perf in production. */
@font-face {
  font-family: "Stagnan";
  src: url("assets/fonts/stagnan-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Stagnan";
  src: url("assets/fonts/stagnan-medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Stagnan";
  src: url("assets/fonts/stagnan-semibold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Stagnan";
  src: url("assets/fonts/stagnan-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Stagnan";
  src: url("assets/fonts/stagnan-extrabold.otf") format("opentype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0f;
  --bg-2: #111118;
  --surface: #15151d;
  --surface-2: #1c1c26;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f5f5f7;
  --text-dim: #a4a4b0;
  --text-faint: #6b6b78;

  --brand: #ff4757;
  --brand-2: #ff6b78;
  --brand-soft: rgba(255, 71, 87, 0.14);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-glow: 0 20px 60px -20px rgba(255, 71, 87, 0.45);
  --shadow-card: 0 12px 40px -12px rgba(0, 0, 0, 0.5);

  --font-display: "Stagnan", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "Stagnan", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --container: 1200px;
}

/* Arabic has no Stagnan glyphs - use Cairo first so Arabic text is shaped
   correctly, then fall back to Stagnan for any inline Latin characters. */
html[lang="ar"] {
  --font-display: "Cairo", "Stagnan", system-ui, sans-serif;
  --font-body:    "Cairo", "Stagnan", system-ui, sans-serif;
}

* { box-sizing: border-box; }
*::selection { background: var(--brand); color: #fff; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

[hidden] { display: none !important; }

/* ---------- Accessibility: skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; outline: 2px solid #fff; }

/* ---------- Inline SVG sprite + icons ---------- */
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  fill: currentColor;
}
.icon--lg { width: 28px; height: 28px; }
.service__icon .icon { width: 28px; height: 28px; }

/* Footer link icons */
.footer__links a { display: inline-flex; align-items: center; gap: 8px; }

/* ----------- Background decoration ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at top, #000 30%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}
.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}
.bg-glow--1 {
  background: radial-gradient(circle, var(--brand) 0%, transparent 60%);
  top: -200px;
  right: -150px;
  animation: floatA 14s ease-in-out infinite;
}
.bg-glow--2 {
  background: radial-gradient(circle, #5b8cff 0%, transparent 60%);
  bottom: -250px;
  left: -200px;
  opacity: 0.35;
  animation: floatB 18s ease-in-out infinite;
}
@keyframes floatA {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-40px, 60px); }
}
@keyframes floatB {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(60px, -40px); }
}

/* ---------- NAV ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 4vw, 48px);
  backdrop-filter: blur(14px);
  background: rgba(10, 10, 15, 0.6);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.nav.is-scrolled {
  background: rgba(10, 10, 15, 0.85);
  border-bottom-color: var(--border);
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.nav__mark { width: 32px; height: 32px; border-radius: 7px; }
.nav__wordmark { color: var(--text); }

.nav__links {
  display: flex;
  gap: 36px;
}
.nav__links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  position: relative;
  transition: color 0.2s;
}
.nav__links a:hover,
.nav__links a.active { color: var(--text); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s;
}
.nav__links a:hover::after,
.nav__links a.active::after { transform: scaleX(1); }

.nav__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  transition: all 0.2s;
}
.lang-toggle:hover {
  color: var(--text);
  border-color: var(--brand);
}
.lang-toggle__current { color: var(--brand); }
.lang-toggle__sep { opacity: 0.4; }

.nav__burger {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.nav__burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s, opacity 0.25s;
}
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 78px 0 0 0;
  z-index: 49;
  background: rgba(10, 10, 15, 0.96);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  animation: slideDown 0.25s ease;
}
.mobile-menu a {
  padding: 16px 18px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 12px;
  color: var(--text);
  border: 1px solid var(--border);
}
.mobile-menu a.btn { justify-content: center; margin-top: 8px; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn--sm { padding: 10px 16px; font-size: 13px; }
.btn--lg { padding: 16px 28px; font-size: 16px; }

.btn--primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn--primary:hover {
  background: var(--brand-2);
  transform: translateY(-2px);
  box-shadow: 0 24px 70px -20px rgba(255, 71, 87, 0.65);
}

.btn--ghost {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--brand);
  color: var(--brand);
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(48px, 9vw, 120px) clamp(20px, 4vw, 48px) clamp(60px, 8vw, 100px);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 28px;
}
.eyebrow__dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.5vw, 76px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: 0 0 24px;
}
.hero__title span { display: block; }
.hero__title-accent {
  background: linear-gradient(120deg, var(--brand), #ff8a96 60%, var(--brand));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient 6s ease-in-out infinite;
}
@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero__sub {
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 0 36px;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 56px;
}

.hero__marquee {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  margin-top: 12px;
}
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee__track {
  display: flex;
  gap: 28px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-faint);
  animation: scroll 38s linear infinite;
}
.marquee__track span:not(:nth-child(even)) { color: var(--text-dim); }
@keyframes scroll {
  to { transform: translateX(-50%); }
}
html[dir="rtl"] .marquee__track { animation-direction: reverse; }

/* Hero floating code card */
.hero__card {
  position: relative;
  perspective: 1200px;
}
.code {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  direction: ltr;
  text-align: left;
  transform: rotate3d(0.5, -1, 0, 8deg);
  transition: transform 0.4s ease;
  overflow: hidden;
  animation: floatCard 6s ease-in-out infinite;
}
.code:hover { transform: rotate3d(0, 0, 0, 0deg); }
@keyframes floatCard {
  0%, 100% { transform: rotate3d(0.5, -1, 0, 8deg) translateY(0); }
  50% { transform: rotate3d(0.5, -1, 0, 8deg) translateY(-12px); }
}
.code__top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  direction: ltr;
}
.code__dot { width: 12px; height: 12px; border-radius: 50%; }
.code__file {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}
.code__body {
  margin: 0;
  padding: 22px 24px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-dim);
  white-space: pre;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}
.t-key { color: #ff8a96; }
.t-var { color: #f5f5f7; }
.t-prop { color: #82c4ff; }
.t-str { color: #a8e6a3; }

/* ---------- SECTIONS ---------- */
.section {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(70px, 10vw, 130px) clamp(20px, 4vw, 48px);
}
.section__head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 64px;
}
.section__kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brand);
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}
.section__title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 52px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
}
.section__sub {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.6;
  margin: 0;
}

/* ---------- SERVICES ---------- */
.services {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.service {
  position: relative;
  padding: 36px 32px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
}
.service::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), var(--brand-soft), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.service:hover {
  transform: translateY(-6px);
  border-color: var(--brand);
  box-shadow: 0 30px 60px -30px rgba(255, 71, 87, 0.4);
}
.service:hover::before { opacity: 1; }

.service__num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 22px;
}
.service__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 22px;
}
.service__icon svg { width: 28px; height: 28px; }

.service h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.service p {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 20px;
}
.service__tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.service__tags li {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.service--feature {
  background: linear-gradient(180deg, rgba(255, 71, 87, 0.08), var(--surface));
  border-color: rgba(255, 71, 87, 0.3);
}
.service--feature .service__icon {
  background: var(--brand);
  color: #fff;
}
.service__badge {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 5px 11px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
html[dir="rtl"] .service__badge { right: auto; left: 24px; }

/* ---------- PROCESS ---------- */
.process {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.process__step {
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  transition: border-color 0.3s, transform 0.3s;
}
.process__step:hover {
  border-color: var(--brand);
  transform: translateY(-4px);
}
.process__num {
  display: inline-block;
  font-family: var(--font-mono);
  color: var(--brand);
  font-size: 13px;
  margin-bottom: 16px;
}
.process__step h4 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 10px;
}
.process__step p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

/* ---------- ABOUT ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 64px;
  align-items: center;
}
.about__lead {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 18px 0 0;
}
.about__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.stat {
  padding: 28px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  transition: border-color 0.3s, transform 0.3s;
}
.stat:hover { border-color: var(--brand); transform: translateY(-4px); }
.stat__num {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand);
  line-height: 1;
}
.stat__label {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- CTA ---------- */
.cta__card {
  position: relative;
  padding: clamp(48px, 7vw, 88px) clamp(24px, 5vw, 64px);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 71, 87, 0.25), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(91, 140, 255, 0.18), transparent 50%),
    linear-gradient(180deg, var(--surface-2), var(--bg-2));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  overflow: hidden;
}
.cta__card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  opacity: 0.5;
}
.cta__card > * { position: relative; }

.cta__title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 12px 0 16px;
  line-height: 1.1;
}
.cta__sub {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.6;
  margin: 0 auto 36px;
  max-width: 520px;
}
.cta__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
.cta__hint {
  margin-top: 28px;
  font-size: 14px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ---------- FOOTER ---------- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 40px clamp(20px, 4vw, 48px);
}
.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.footer__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.footer__brand img { width: 36px; height: 36px; border-radius: 8px; }
.footer__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}
.footer__tag {
  color: var(--text-faint);
  font-size: 13px;
  font-family: var(--font-mono);
}
.footer__links {
  display: flex;
  gap: 28px;
}
.footer__links a {
  color: var(--text-dim);
  font-size: 14px;
  transition: color 0.2s;
}
.footer__links a:hover { color: var(--brand); }
.footer__copy {
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- REVEAL animations ----------
   Progressive enhancement: content is visible by default so the page still
   renders if JS fails to load (e.g. when opening via file://). The hidden
   initial state is only applied when <html> has the `js` class, which is
   set synchronously at the top of <head>. */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
html.js [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- RTL adjustments ---------- */
html[dir="rtl"] .hero__title-accent { background-position: 100% 50%; }
html[dir="rtl"] .nav__links a::after { transform-origin: right; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero__card { order: -1; max-width: 480px; }
  .services { grid-template-columns: 1fr; }
  .process { grid-template-columns: repeat(2, 1fr); }
  .about__grid { grid-template-columns: 1fr; gap: 40px; }
  .nav__links { display: none; }
  .nav__burger { display: inline-flex; }
}

@media (max-width: 560px) {
  .nav { padding: 14px 18px; }
  .nav__brand { font-size: 18px; }
  .nav__mark { width: 28px; height: 28px; }
  .lang-toggle { padding: 6px 10px; font-size: 11px; }
  .nav__actions .btn { display: none; }

  .hero { padding-top: 36px; }
  .hero__cta { flex-direction: column; }
  .hero__cta .btn { width: 100%; }
  .code__body { font-size: 12px; padding: 16px 18px; }

  .process { grid-template-columns: 1fr; }
  .about__stats { grid-template-columns: repeat(2, 1fr); }

  .footer__inner { flex-direction: column; text-align: center; }
}
