/* ==========================================================================
   TechRoad — Design tokens, reset and base typography
   Brand: #4329cd violet → #67d1e7 cyan → #00e5a0 emerald
   ========================================================================== */

/* ---------------------------------------------------------------- *
   1. Tokens
 * ---------------------------------------------------------------- */
:root {
  /* --- brand ramp --- */
  --violet-900: #1a0f52;
  --violet-800: #251676;
  --violet-700: #331e9e;
  --violet-600: #4329cd;   /* brand primary */
  --violet-500: #5b47e0;
  --violet-400: #7b6bea;
  --violet-300: #a79bf2;

  --azure-600: #2563eb;
  --azure-500: #3b82f6;
  --azure-400: #60a5fa;

  --cyan-600:  #22a5c4;
  --cyan-500:  #45bcd8;
  --cyan-400:  #67d1e7;    /* brand gradient end */
  --cyan-300:  #9ae4f2;

  --emerald-600: #00b783;
  --emerald-500: #00cf93;
  --emerald-400: #00e5a0;  /* official-logo glow */
  --emerald-300: #5ef2c4;

  --ink-900: #16171a;
  --ink-800: #2c2d2f;      /* brand secondary */

  /* --- signature gradients --- */
  --grad-brand: linear-gradient(115deg, #4329cd 0%, #3b82f6 34%, #67d1e7 66%, #00e5a0 100%);
  --grad-brand-soft: linear-gradient(115deg, rgba(67,41,205,.9), rgba(103,209,231,.85) 60%, rgba(0,229,160,.85));
  --grad-cool: linear-gradient(135deg, #4329cd, #67d1e7);
  --grad-warmcool: linear-gradient(135deg, #67d1e7, #00e5a0);
  --grad-line: linear-gradient(90deg, transparent, rgba(103,209,231,.55), transparent);

  /* --- radii --- */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-2xl: 40px;
  --r-pill: 999px;

  /* --- spacing --- */
  --s-1: .25rem;  --s-2: .5rem;   --s-3: .75rem;  --s-4: 1rem;
  --s-5: 1.25rem; --s-6: 1.5rem;  --s-8: 2rem;    --s-10: 2.5rem;
  --s-12: 3rem;   --s-16: 4rem;   --s-20: 5rem;   --s-24: 6rem;

  --section-y: clamp(4rem, 2.8rem + 6vw, 8.25rem);
  --gutter:    clamp(1.25rem, .6rem + 2.6vw, 3rem);
  --maxw:      1280px;
  --maxw-wide: 1560px;
  --maxw-text: 68ch;

  /* --- type --- */
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --font-arabic:  "IBM Plex Sans Arabic", "Tajawal", "Segoe UI", sans-serif;

  --fs-xs:   clamp(.75rem, .73rem + .1vw, .8125rem);
  --fs-sm:   clamp(.8125rem, .79rem + .12vw, .875rem);
  --fs-base: clamp(.9375rem, .91rem + .16vw, 1.0625rem);
  --fs-md:   clamp(1.0625rem, 1.01rem + .22vw, 1.1875rem);
  --fs-lg:   clamp(1.1875rem, 1.09rem + .38vw, 1.4rem);
  --fs-xl:   clamp(1.35rem, 1.17rem + .72vw, 1.85rem);
  --fs-2xl:  clamp(1.7rem, 1.36rem + 1.35vw, 2.6rem);
  --fs-3xl:  clamp(2.1rem, 1.55rem + 2.2vw, 3.5rem);
  --fs-4xl:  clamp(2.6rem, 1.6rem + 4vw, 5rem);
  --fs-5xl:  clamp(3rem, 1.3rem + 7vw, 7.5rem);

  --lh-tight: 1.04;
  --lh-snug:  1.18;
  --lh-base:  1.68;
  --lh-loose: 1.8;

  --tracking-tight: -.035em;
  --tracking-snug:  -.018em;
  --tracking-wide:  .16em;

  /* --- motion --- */
  --ease-out:   cubic-bezier(.22, 1, .36, 1);
  --ease-inout: cubic-bezier(.65, 0, .35, 1);
  --ease-spring:cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: .22s;
  --dur-base: .42s;
  --dur-slow: .8s;
  --dur-xslow: 1.4s;

  /* --- layering --- */
  --z-canvas: 0;
  --z-content: 10;
  --z-header: 100;
  --z-menu: 200;
  --z-overlay: 300;
  --z-cursor: 9999;
}

/* ---------------------------------------------------------------- *
   2. Themes
 * ---------------------------------------------------------------- */

/* Dark is the primary, designed-for theme. */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  --bg:          #05070f;
  --bg-deep:     #02030a;
  --bg-raised:   #0a0e1c;
  --surface:     rgba(255, 255, 255, .034);
  --surface-2:   rgba(255, 255, 255, .058);
  --surface-3:   rgba(255, 255, 255, .085);
  --surface-solid:#0d1222;

  --text:        #eef2fb;
  --text-2:      #b6c0d6;
  --text-3:      #8792ab;
  --text-4:      #5d6883;

  --line:        rgba(150, 180, 255, .11);
  --line-2:      rgba(150, 180, 255, .19);
  --line-bright: rgba(103, 209, 231, .38);

  --accent:      #67d1e7;
  --accent-2:    #00e5a0;
  --accent-3:    #7b6bea;
  --accent-ink:  #04060d;

  --glow-a: rgba(67, 41, 205, .40);
  --glow-b: rgba(103, 209, 231, .26);
  --glow-c: rgba(0, 229, 160, .22);

  --shadow-sm: 0 2px 10px rgba(0,0,0,.34);
  --shadow-md: 0 14px 42px rgba(0,0,0,.46);
  --shadow-lg: 0 34px 90px rgba(0,0,0,.58);
  --shadow-glow: 0 0 0 1px rgba(103,209,231,.18), 0 18px 60px rgba(67,41,205,.30);

  --grain-opacity: .034;
  --header-bg: rgba(5, 7, 15, .68);

  --ambient-a: rgba(67, 41, 205, .13);
  --ambient-b: rgba(0, 229, 160, .075);
  --ambient-c: rgba(103, 209, 231, .07);
}

[data-theme="light"] {
  color-scheme: light;

  --bg:          #f6f8fd;
  --bg-deep:     #ffffff;
  --bg-raised:   #ffffff;
  --surface:     rgba(20, 30, 60, .034);
  --surface-2:   rgba(20, 30, 60, .058);
  --surface-3:   rgba(20, 30, 60, .085);
  --surface-solid:#ffffff;

  --text:        #12141c;
  --text-2:      #3c4557;
  --text-3:      #5d6883;
  --text-4:      #8792ab;

  --line:        rgba(20, 30, 70, .11);
  --line-2:      rgba(20, 30, 70, .17);
  --line-bright: rgba(67, 41, 205, .34);

  --accent:      #3d21b8;
  --accent-2:    #00926c;
  --accent-3:    #4329cd;
  --accent-ink:  #ffffff;

  --glow-a: rgba(67, 41, 205, .16);
  --glow-b: rgba(103, 209, 231, .20);
  --glow-c: rgba(0, 229, 160, .16);

  --shadow-sm: 0 2px 8px rgba(20,30,70,.07);
  --shadow-md: 0 14px 38px rgba(20,30,70,.10);
  --shadow-lg: 0 34px 80px rgba(20,30,70,.14);
  --shadow-glow: 0 0 0 1px rgba(67,41,205,.12), 0 18px 50px rgba(67,41,205,.14);

  --grain-opacity: .02;
  --header-bg: rgba(246, 248, 253, .74);

  --ambient-a: rgba(67, 41, 205, .055);
  --ambient-b: rgba(0, 229, 160, .045);
  --ambient-c: rgba(103, 209, 231, .05);
}

/* ---------------------------------------------------------------- *
   3. Reset
 * ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

html.has-smooth-scroll { scroll-behavior: auto; }

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color .5s var(--ease-out), color .5s var(--ease-out);
}

body.is-locked { overflow: hidden; }

/*
 * Ambient depth. A single fixed layer of very soft brand glows keeps the
 * long dark sections from reading flat, at no per-section markup cost.
 * `.hero` isolates its own stacking context, so this sits behind everything.
 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 42% at 10% 20%,  var(--ambient-a), transparent 62%),
    radial-gradient(ellipse 48% 40% at 92% 58%,  var(--ambient-b), transparent 62%),
    radial-gradient(ellipse 44% 34% at 46% 96%,  var(--ambient-c), transparent 62%);
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; }

table { border-collapse: collapse; width: 100%; }

:target { scroll-margin-top: 6rem; }

::selection {
  background: rgba(103, 209, 231, .28);
  color: var(--text);
}

/* Scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--violet-600), var(--cyan-400));
  border-radius: 99px;
  border: 3px solid var(--bg-deep);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--violet-500), var(--emerald-400)); }

/* ---------------------------------------------------------------- *
   4. Typography
 * ---------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
  color: var(--text);
}

h1 { font-size: var(--fs-4xl); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); font-weight: 700; }
h2 { font-size: var(--fs-3xl); line-height: 1.08; letter-spacing: var(--tracking-tight); font-weight: 700; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); }

p { text-wrap: pretty; }

strong, b { font-weight: 650; color: var(--text); }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: .92em; }

code {
  background: var(--surface-2);
  padding: .12em .42em;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  color: var(--accent);
}

hr {
  border: 0;
  height: 1px;
  background: var(--line);
}

/* ---------------------------------------------------------------- *
   5. Arabic / RTL
 * ---------------------------------------------------------------- */
[dir="rtl"] {
  --font-display: "IBM Plex Sans Arabic", "Tajawal", "Segoe UI", sans-serif;
  --font-body:    "IBM Plex Sans Arabic", "Tajawal", "Segoe UI", sans-serif;

  /* Arabic script needs more vertical room and must never be letter-spaced. */
  --lh-tight: 1.30;
  --lh-snug:  1.45;
  --lh-base:  1.95;
  --lh-loose: 2.05;

  --tracking-tight: 0;
  --tracking-snug:  0;
  --tracking-wide:  0;
}

[dir="rtl"] body { font-feature-settings: "kern" 1, "liga" 1; }

/* Letter-spacing breaks connected Arabic letterforms — neutralise it globally. */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] .eyebrow, [dir="rtl"] .btn,
[dir="rtl"] .nav-link, [dir="rtl"] .stat-label {
  letter-spacing: 0 !important;
}

/* Latin fragments inside Arabic text keep their own direction. */
[dir="rtl"] .ltr,
[dir="rtl"] code,
[dir="rtl"] .tech-chip,
[dir="rtl"] .num,
[dir="rtl"] [data-latin] {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-body);
}
[dir="rtl"] .stat-value,
[dir="rtl"] .phone-number,
[dir="rtl"] .process-num {
  direction: ltr;
  unicode-bidi: embed;
}

/* Arabic headlines sit slightly heavier to match Latin optical weight. */
[dir="rtl"] h1 { font-weight: 700; }
[dir="rtl"] h2 { font-weight: 700; }

/* ---------------------------------------------------------------- *
   6. Layout primitives
 * ---------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-wide { max-width: var(--maxw-wide); }
.container-narrow { max-width: 900px; }

.section {
  position: relative;
  padding-block: var(--section-y);
}
.section-tight { padding-block: clamp(3rem, 2rem + 4vw, 6rem); }

.stack > * + * { margin-block-start: var(--flow, 1.2em); }

.grid { display: grid; gap: var(--gap, clamp(1rem, .6rem + 1.4vw, 2rem)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.wrap { flex-wrap: wrap; }

.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.measure { max-width: var(--maxw-text); }
.measure-sm { max-width: 54ch; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- *
   7. Shared text treatments
 * ---------------------------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent);
}
[dir="rtl"] .eyebrow {
  font-family: var(--font-body);
  text-transform: none;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.eyebrow::before {
  content: "";
  width: 1.9rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
  flex: none;
}
[dir="rtl"] .eyebrow::before {
  background: linear-gradient(270deg, transparent, currentColor);
}
.eyebrow-plain::before { display: none; }

.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: normal;
}

/*
 * When a gradient heading is split into animated spans, each `.word-mask`
 * sets overflow:hidden and so establishes its own clip — an ancestor's
 * `background-clip: text` is not painted through it. Repeat the gradient on
 * the inner spans so split headings still render.
 */
.grad-text .w,
.grad-text .char {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  font-size: var(--fs-lg);
  line-height: 1.6;
  color: var(--text-2);
  font-weight: 400;
}
[dir="rtl"] .lede { line-height: 1.95; }

.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }

.section-head {
  display: grid;
  gap: var(--s-5);
  margin-block-end: clamp(2.5rem, 1.6rem + 3vw, 4.5rem);
}
.section-head .lede { max-width: 62ch; }
.section-head--center {
  justify-items: center;
  text-align: center;
}
.section-head--split {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(1.5rem, 1rem + 3vw, 4rem);
}
@media (max-width: 880px) {
  .section-head--split { grid-template-columns: minmax(0, 1fr); align-items: start; }
}

/* ---------------------------------------------------------------- *
   8. Focus & accessibility
 * ---------------------------------------------------------------- */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

.skip-link {
  position: fixed;
  inset-block-start: -100px;
  inset-inline-start: 1rem;
  z-index: 10000;
  padding: .85rem 1.4rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: inset-block-start .25s var(--ease-out);
}
.skip-link:focus-visible { inset-block-start: 1rem; }

/* ---------------------------------------------------------------- *
   9. Ambient atmosphere (grain + aurora)
 * ---------------------------------------------------------------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 400;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  will-change: transform;
}
.aurora .a1 { width: 46vw; height: 46vw; background: var(--glow-a); inset-block-start: -14vw; inset-inline-start: -10vw; animation: drift-a 26s var(--ease-inout) infinite; }
.aurora .a2 { width: 38vw; height: 38vw; background: var(--glow-b); inset-block-end: -12vw; inset-inline-end: -8vw; animation: drift-b 32s var(--ease-inout) infinite; }
.aurora .a3 { width: 30vw; height: 30vw; background: var(--glow-c); inset-block-start: 34%; inset-inline-start: 46%; animation: drift-c 38s var(--ease-inout) infinite; }

.noise-line {
  height: 1px;
  background: var(--grad-line);
  border: 0;
  opacity: .7;
}

/* ---------------------------------------------------------------- *
   10. Utility surfaces
 * ---------------------------------------------------------------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.card-surface {
  position: relative;
  background:
    linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.012)),
    var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
[data-theme="light"] .card-surface {
  background: linear-gradient(160deg, #fff, #f7f9ff);
  box-shadow: var(--shadow-sm);
}

.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin-block: var(--s-8);
}

/* ---------------------------------------------------------------- *
   11. Reduced motion
 * ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .aurora span { animation: none !important; }
}

/* ---------------------------------------------------------------- *
   12. Print
 * ---------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .cursor, .grain, .preloader,
  .scroll-progress, .aurora, .hero-canvas, .to-top { display: none !important; }
  body { background: #fff; color: #000; }
  a::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
