/* ============================================================
   Base
   Reset, body, container, page shell, page loading screen,
   section primitives, headings, utilities — dark theme.
   ============================================================ */

/* RTL overrides for Arabic */
html[dir="rtl"] {
  direction: rtl;
}
html[dir="rtl"] body {
  font-family: "Noto Sans Arabic", "Noto Sans SC", "Inter", sans-serif;
}

/* Headings & utilities */
.heading-1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5.6vw, 72px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.heading-2 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.heading-3 {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.heading-4 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.body-lg {
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text-secondary);
}
.body-muted {
  color: var(--color-text-muted);
}
.overline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-accent);
  font: 600 12px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.overline::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.65;
}

/* Tabular numerals for data-heavy interfaces */
.num,
.hero-stat-number,
.stats-number {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Serif accent — used sparingly for editorial emphasis */
.serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  background: var(--color-bg);
}
body {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}
/* Global grain overlay — fixed, no interaction, breaks flat surfaces */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2500;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.85 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}
html.i18n-loading body {
  overflow: hidden;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
ul {
  list-style: none;
}

/* Selection */
::selection {
  background: var(--color-accent);
  color: #fff;
}

/* Container */
.container {
  width: min(var(--max-w), calc(100% - 40px));
  margin: 0 auto;
  position: relative;
}
.page-shell {
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}
html.i18n-loading .page-shell {
  opacity: 0;
  visibility: hidden;
}

/* Page loading screen */
.page-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 12% 18%, rgba(111, 154, 255, 0.18), transparent 0 30%),
    radial-gradient(circle at 88% 14%, rgba(255, 141, 74, 0.18), transparent 0 26%),
    linear-gradient(180deg, #051a36 0%, #143461 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
  z-index: 3000;
}
html.i18n-loading .page-loading {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.page-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-width: 164px;
  padding: 28px 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}
.page-loading-logo {
  width: 88px;
  height: auto;
}
.page-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: page-loading-spin 0.8s linear infinite;
}
@keyframes page-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1024px) {
  .container {
    width: min(var(--max-w), calc(100% - 32px));
  }
}
@media (max-width: 640px) {
  .container {
    width: min(var(--max-w), calc(100% - 24px));
  }
}

/* Section primitives — dark layered surfaces */
.section {
  padding: 96px 0;
  position: relative;
  background: var(--color-bg);
  color: var(--color-text);
}
.section.alt,
.section.section-gray {
  background: var(--color-bg-alt);
}
.section.dark {
  background:
    radial-gradient(circle at 12% 20%, rgba(111, 154, 255, 0.18), transparent 0 28%),
    radial-gradient(circle at 88% 16%, rgba(255, 165, 84, 0.16), transparent 0 24%),
    linear-gradient(135deg, var(--color-brand), var(--color-surface-darker));
  color: var(--color-text);
}
/* Subtle section divider line at the top of each non-first section */
.section + .section::before,
.section.alt + .section.alt::before,
.section.dark + .section.dark::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--max-w), 80%);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
}

.section-head,
.section-header {
  display: grid;
  gap: 12px;
  margin-bottom: 48px;
  text-align: center;
  justify-items: center;
}
.section-head h2,
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
  color: var(--color-text);
}
.section-head p,
.section-header p {
  max-width: 720px;
  color: var(--color-text-secondary);
  font-size: 17px;
  line-height: 1.7;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-accent);
  font: 600 12px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.65;
}

@media (max-width: 1024px) {
  .section {
    padding: 72px 0;
  }
  .section-head {
    margin-bottom: 36px;
  }
}
@media (max-width: 640px) {
  .section {
    padding: 56px 0;
  }
  .section-head {
    margin-bottom: 28px;
  }
}
