/* Minimal, production-friendly styles (no framework) */
:root {
  /* Brand-aligned color system (calm, app-like, high-contrast). */
  --bg: #071427;               /* deep navy */
  --bg-elev: rgba(7, 20, 39, 0.72);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(226, 236, 255, 0.74);
  --border: rgba(213, 230, 255, 0.14);
  --border-strong: rgba(213, 230, 255, 0.22);

  --primary: #2f6df6;          /* primary blue */
  --primary-2: #1e4bd9;        /* deeper blue for gradient depth */
  --accent: #22c7e6;           /* light blue / cyan accent */
  --gold: rgba(245, 200, 90, 0.38); /* optional subtle accent (sparingly) */

  --link: rgba(206, 226, 255, 0.95);
  --focus: rgba(34, 199, 230, 0.55);
  --shadow: 0 14px 46px rgba(0, 0, 0, 0.38);
  --radius: 18px;
  --max: 1040px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(900px 420px at 12% 8%, rgba(47, 109, 246, 0.22), transparent 62%),
    radial-gradient(740px 380px at 86% 14%, rgba(34, 199, 230, 0.16), transparent 66%),
    radial-gradient(900px 520px at 50% 100%, rgba(255, 255, 255, 0.045), transparent 60%),
    var(--bg);
  line-height: 1.55;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 12px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.skip-link:focus { left: 12px; z-index: 999; }

.container {
  /* Avoid RTL/mobile layout edge-cases with min()+calc() width math. */
  width: 100%;
  max-width: var(--max);
  padding: 0 20px;
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background: var(--bg-elev);
  border-bottom: 1px solid rgba(213, 230, 255, 0.10);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 18px;
  line-height: 1;
  /* Keep wordmark crisp/readable against dark header. */
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(7, 20, 39, 0.10);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}
.brand:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(7, 20, 39, 0.14);
}
.brand:focus-visible { text-decoration: none; }
.brand-logo {
  display: block;
  /* Keep the logo fully visible (no cropping), as it's a wide wordmark. */
  height: 64px;
  width: auto;
  max-width: clamp(220px, 30vw, 420px);
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  background: transparent;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background:
    radial-gradient(18px 18px at 30% 35%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.12)),
    linear-gradient(135deg, rgba(47, 109, 246, 0.98), rgba(34, 199, 230, 0.78));
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(213, 230, 255, 0.18);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-links a {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--muted);
}
.nav-links a[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.nav-links a:hover {
  background: var(--surface);
  border-color: var(--border);
  text-decoration: none;
}

/* RTL header alignment (keep brand + controls balanced) */
.rtl .nav {
  flex-direction: row-reverse;
}
.rtl .nav-links {
  justify-content: flex-start;
}
.rtl .lang {
  padding-left: 0;
  padding-right: 4px;
}
.rtl .brand {
  letter-spacing: 0;
}

main { padding: 36px 0 48px; }

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 26px;
  align-items: stretch;
  padding: 34px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(213, 230, 255, 0.16);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: var(--border-strong); background: rgba(255, 255, 255, 0.075); }
.btn.primary {
  border-color: rgba(47, 109, 246, 0.40);
  background: linear-gradient(135deg, rgba(47, 109, 246, 0.95), rgba(34, 199, 230, 0.74));
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(18, 62, 164, 0.34);
}
.btn.primary:hover { filter: brightness(1.04); }

.hero-card {
  border-radius: 16px;
  border: 1px solid rgba(213, 230, 255, 0.14);
  background: rgba(0, 0, 0, 0.12);
  padding: 16px;
}
.hero-card h2 {
  margin: 0 0 8px;
  font-size: 14px;
  color: rgba(226, 236, 255, 0.86);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.hero-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.hero-card li { margin: 8px 0; }

.section {
  margin-top: 28px;
  padding: 26px 0 0;
}
.section h2 {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 16px;
}
.support strong { font-weight: 700; }
.support a { color: rgba(226, 236, 255, 0.95); }

.site-footer {
  border-top: 1px solid rgba(213, 230, 255, 0.10);
  padding: 22px 0 30px;
  color: var(--muted);
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-row a { color: rgba(206, 226, 255, 0.95); }
.small { font-size: 13px; }

/* Privacy page */
.doc {
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
}
.doc h1 {
  margin: 0 0 10px;
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: -0.01em;
}
.doc .meta {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}
.doc .content {
  color: rgba(255, 255, 255, 0.92);
  font-size: 16px;
  line-height: 1.9;
}
.doc .content p {
  margin: 0 0 14px;
}
.doc .content h2 {
  margin: 18px 0 10px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.doc .content h3 {
  margin: 14px 0 8px;
  font-size: 15px;
  color: rgba(226, 236, 255, 0.92);
}
.doc .content ul {
  margin: 0 0 14px;
  padding-left: 20px;
  color: rgba(226, 236, 255, 0.88);
}
.rtl .doc .content ul {
  padding-left: 0;
  padding-right: 20px;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 4px;
}
.lang-label {
  color: var(--muted);
  font-size: 13px;
}
.lang-select {
  appearance: none;
  padding: 10px 34px 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  line-height: 1;
}
.lang-select:hover { border-color: var(--border-strong); }
.lang-select {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(226, 236, 255, 0.75) 50%),
    linear-gradient(135deg, rgba(226, 236, 255, 0.75) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .grid { grid-template-columns: 1fr; }
  .nav { padding: 14px 0; }
  .brand { font-size: 17px; gap: 10px; padding: 7px 10px; }
  .brand-logo { height: 54px; max-width: 320px; }
  .lang-label { display: none; }
}

/* Mobile hard fallback:
   Some mobile browsers can render a blank page when combining sticky + backdrop-filter/translucency,
   especially under RTL. On mobile, simplify the header to a solid, non-composited block. */
@media (max-width: 860px) {
  .site-header {
    position: relative !important; /* no sticky on mobile */
    top: auto !important;
    background-color: var(--bg) !important; /* solid only */
    background-image: none !important;
    opacity: 1 !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    will-change: auto !important;
  }

  /* If any child element gets composited effects (RTL toggles, hover styles, etc),
     force them off on mobile to avoid blank-page GPU/render bugs. */
  .site-header * {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    will-change: auto !important;
  }
}

/* -------------------------------------------------------------------------- */
/* Mobile RTL safe mode                                                        */
/* -------------------------------------------------------------------------- */
/* Goal: guarantee visibility/scrolling on mobile Arabic (RTL) by disabling
   compositing-heavy/sticky/overlay effects site-wide only in this mode. */
@media (max-width: 860px) {
  html.mobile-rtl-safe,
  html.mobile-rtl-safe body {
    height: auto !important;
    min-height: 100% !important;
    overflow: auto !important;
    overflow-x: hidden !important;
    background: var(--bg) !important;
    background-image: none !important;
  }

  /* Remove fragile paint/compositing triggers broadly. */
  html.mobile-rtl-safe *,
  html.mobile-rtl-safe *::before,
  html.mobile-rtl-safe *::after {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    will-change: auto !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  /* Neutralize sticky/fixed elements that can trigger blank renders under RTL. */
  html.mobile-rtl-safe .site-header,
  html.mobile-rtl-safe [style*="position:sticky"],
  html.mobile-rtl-safe [style*="position: sticky"] {
    position: relative !important;
    top: auto !important;
  }

  /* Ensure normal vertical flow & scrolling. */
  html.mobile-rtl-safe main,
  html.mobile-rtl-safe .container,
  html.mobile-rtl-safe .hero,
  html.mobile-rtl-safe .section,
  html.mobile-rtl-safe .grid,
  html.mobile-rtl-safe .support,
  html.mobile-rtl-safe .doc,
  html.mobile-rtl-safe .doc .content,
  html.mobile-rtl-safe .site-footer {
    position: static !important;
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    contain: none !important;
  }

  /* Simplify layout blocks that otherwise rely on grid/flex math. */
  html.mobile-rtl-safe .nav,
  html.mobile-rtl-safe .nav-links,
  html.mobile-rtl-safe .cta-row,
  html.mobile-rtl-safe .footer-row {
    display: block !important;
  }

  html.mobile-rtl-safe .nav-links > * {
    display: block !important;
    width: 100% !important;
  }

  html.mobile-rtl-safe .hero {
    padding: 18px !important;
    box-shadow: none !important;
  }

  html.mobile-rtl-safe .card,
  html.mobile-rtl-safe .hero-card,
  html.mobile-rtl-safe .support,
  html.mobile-rtl-safe .doc {
    box-shadow: none !important;
  }

  /* Avoid any pseudo overlay blocking content. */
  html.mobile-rtl-safe *::before,
  html.mobile-rtl-safe *::after {
    pointer-events: none !important;
  }
}
