/* ==========================================================================
   SITE PULSE — design tokens, base, nav, hero
   Signature motif: the "pulse" — an ECG line that runs through the page,
   because the brand promise is a site that *pulses*.
   ========================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  --font-ar-display: 'Alexandria', 'IBM Plex Sans Arabic', sans-serif;
  --font-ar-body: 'IBM Plex Sans Arabic', 'Alexandria', sans-serif;
  --font-en-display: 'Sora', 'Alexandria', sans-serif;
  --font-en-body: 'IBM Plex Sans Arabic', 'Sora', sans-serif;

  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 9px;
  --wrap: 1200px;
  --gutter: 24px;

  /* animation intensity: 1 (calm) → 5 (full) */
  --anim: 4;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- DARK NEON (default) ---------- */
:root,
html[data-theme="dark"] {
  --bg: #070A11;
  --bg-2: #0B0F19;
  --surface: rgba(255, 255, 255, .028);
  --surface-2: rgba(255, 255, 255, .05);
  --surface-solid: #101624;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --ink: #EAF2FF;
  --ink-2: #B9C7DE;
  --muted: #8896AF;
  --faint: #5A6782;

  --accent: #ACE256;
  --accent-2: #17DAD2;
  --accent-ink: #12200A;
  --accent-soft: rgba(172, 226, 86, .1);
  --accent-line: rgba(172, 226, 86, .34);

  --glow: 0 0 40px rgba(172, 226, 86, .2);
  --glow-strong: 0 0 70px rgba(172, 226, 86, .32);
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, .9);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 26px 50px -32px rgba(0, 0, 0, .95);
  --nav-bg: rgba(7, 10, 17, .72);
  --scrim: radial-gradient(120% 80% at 50% -10%, rgba(23, 218, 210, .1), transparent 60%),
           radial-gradient(90% 60% at 88% 8%, rgba(172, 226, 86, .1), transparent 62%);
  --grain-op: .5;
  color-scheme: dark;
}

/* ---------- LIGHT LUXE ---------- */
html[data-theme="light"] {
  --bg: #F6F4EF;
  --bg-2: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #FBF9F5;
  --surface-solid: #FFFFFF;
  --line: rgba(11, 15, 25, .1);
  --line-strong: rgba(11, 15, 25, .2);
  --ink: #0B0F19;
  --ink-2: #27303F;
  --muted: #5D6a7e;
  --faint: #8C97A8;

  --accent: #05734F;
  --accent-2: #0A6F84;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(5, 115, 79, .07);
  --accent-line: rgba(5, 115, 79, .3);

  --glow: 0 10px 40px -18px rgba(5, 115, 79, .3);
  --glow-strong: 0 18px 60px -22px rgba(5, 115, 79, .38);
  --shadow: 0 24px 60px -34px rgba(11, 15, 25, .3);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 20px 44px -30px rgba(11, 15, 25, .3);
  --nav-bg: rgba(246, 244, 239, .8);
  --scrim: radial-gradient(110% 70% at 50% -12%, rgba(10, 111, 132, .07), transparent 62%),
           radial-gradient(80% 50% at 90% 6%, rgba(5, 115, 79, .07), transparent 60%);
  --grain-op: .32;
  color-scheme: light;
}

/* ---------- PALETTE OVERRIDES (tweak) ---------- */
html[data-palette="cyan"] {
  --accent: #17DAD2; --accent-2: #ACE256; --accent-ink: #04201E;
  --accent-soft: rgba(23, 218, 210, .1); --accent-line: rgba(23, 218, 210, .34);
  --glow: 0 0 40px rgba(23, 218, 210, .2); --glow-strong: 0 0 70px rgba(23, 218, 210, .32);
}
html[data-palette="violet"] {
  --accent: #8B7BFF; --accent-2: #17DAD2; --accent-ink: #0A0620;
  --accent-soft: rgba(139, 123, 255, .12); --accent-line: rgba(139, 123, 255, .36);
  --glow: 0 0 40px rgba(139, 123, 255, .22); --glow-strong: 0 0 70px rgba(139, 123, 255, .34);
}
html[data-theme="light"][data-palette="cyan"] {
  --accent: #076D8C; --accent-2: #05734F; --accent-ink: #FFFFFF;
  --accent-soft: rgba(7, 109, 140, .07); --accent-line: rgba(7, 109, 140, .3);
}
html[data-theme="light"][data-palette="violet"] {
  --accent: #5241C9; --accent-2: #0A6F84; --accent-ink: #FFFFFF;
  --accent-soft: rgba(82, 65, 201, .07); --accent-line: rgba(82, 65, 201, .28);
}

/* ---------- 2. BASE ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ar-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
  overflow-x: hidden;
}
html[lang="en"] body { font-family: var(--font-en-body); }
html[dir="rtl"] body { font-family: var(--font-ar-body); }

h1, h2, h3, h4 {
  margin: 0; font-family: var(--font-ar-display); font-weight: 700;
  line-height: 1.22; letter-spacing: -.01em; text-wrap: balance;
}
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3, html[lang="en"] h4 { font-family: var(--font-en-display); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* font-family tweak */
html[data-font="plex"] body { --font-ar-display: 'IBM Plex Sans Arabic', sans-serif; }
html[data-font="tajawal"] body { --font-ar-display: 'Tajawal', sans-serif; }
html[data-font="tajawal"] h1, html[data-font="tajawal"] h2,
html[data-font="tajawal"] h3 { font-family: 'Tajawal', sans-serif; }

/* ---------- 3. LAYOUT PRIMITIVES ---------- */
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 8vw, 116px); position: relative; }
.section--tight { padding-block: clamp(48px, 5vw, 76px); }

.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px;
}
html[dir="rtl"] .kicker { font-family: var(--font-ar-body); letter-spacing: .06em; font-size: 13px; }
.kicker::before {
  content: ''; width: 26px; height: 2px; background: var(--accent);
  box-shadow: var(--glow); border-radius: 2px;
}
.h2 { font-size: clamp(28px, 3.6vw, 46px); font-weight: 800; }
.h3 { font-size: clamp(19px, 1.7vw, 24px); }
.lead { color: var(--muted); font-size: clamp(15px, 1.15vw, 17.5px); max-width: 62ch; margin-top: 16px; }
.sec-head { margin-bottom: clamp(36px, 4vw, 60px); }

/* ---------- 4. BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 26px; border: 1px solid transparent;
  border-radius: 999px; font-weight: 700; font-size: 15px;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), background .22s, color .22s, border-color .22s;
  white-space: nowrap;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--glow-strong); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn--wide { width: 100%; }
.btn--sm { min-height: 42px; padding: 0 18px; font-size: 13.5px; }
.btn__ico { width: 18px; height: 18px; flex: none; }

/* ---------- 5. REVEAL / ANIMATION GATING ----------
   Progressive enhancement: content is visible by DEFAULT and only hides once
   JS has confirmed it can reveal it again (html.js-reveal). If the script
   never runs — or runs in an environment where scroll events never fire — the
   page still shows every section instead of a stack of blank gaps. */
.reveal { transition: opacity .75s var(--ease), transform .75s var(--ease);
          opacity: 1; transform: none; }
html.js-reveal .reveal:not(.is-in) { opacity: 0; transform: translateY(22px); }
html.js-reveal .reveal.is-in { opacity: 1; transform: none; }
html[data-anim="1"] .reveal, html[data-anim="1"] .reveal:not(.is-in) {
  transition: none; opacity: 1; transform: none;
}
html[data-anim="2"] .reveal { transition-duration: .7s; }

/* elements that only exist at higher intensity */
.only-anim-3, .only-anim-4, .only-anim-5 { display: none; }
html[data-anim="3"] .only-anim-3, html[data-anim="4"] .only-anim-3, html[data-anim="5"] .only-anim-3 { display: block; }
html[data-anim="4"] .only-anim-4, html[data-anim="5"] .only-anim-4 { display: block; }
html[data-anim="5"] .only-anim-5 { display: block; }
html[data-anim="1"] *, html[data-anim="1"] *::before, html[data-anim="1"] *::after { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  .reveal:not(.is-in) { opacity: 1; transform: none; }
}

/* ---------- 6. PULSE MOTIF ---------- */
.pulse-rule { width: 100%; height: 42px; display: block; overflow: visible; }
.pulse-rule path.trace { fill: none; stroke: var(--accent-line); stroke-width: 1.5; }
.pulse-rule path.beat {
  fill: none; stroke: var(--accent); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 7px var(--accent));
}
html[data-anim="1"] .pulse-rule path.beat { stroke-dasharray: none !important; animation: none !important; }
html[data-anim="2"] .pulse-rule path.beat { animation-duration: 7s; }
.pulse-dot { fill: var(--accent); filter: drop-shadow(0 0 8px var(--accent)); }

.pulse-dash {
  display: inline-block; width: 22px; height: 1px; background: var(--accent-line);
  position: relative; vertical-align: middle;
}
html[data-anim="3"] .pulse-dash::after,
html[data-anim="4"] .pulse-dash::after,
html[data-anim="5"] .pulse-dash::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 8px; background: var(--accent);
  box-shadow: 0 0 8px var(--accent); animation: dashRun 2.4s linear infinite;
}
@keyframes dashRun { 0% { transform: translateX(-8px); } 100% { transform: translateX(22px); } }

/* ---------- 7. NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  backdrop-filter: blur(18px) saturate(1.5);
  background: var(--nav-bg);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.is-stuck { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; gap: 20px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 13px; flex: none; }
/* The glyph always carries the logo's lime, independent of the page accent. */
.brand__glyph { color: #ACE256; }
.brand__mark { width: 40px; height: 40px; display: block; flex: none; }
.brand__name { font-family: var(--font-en-display); font-weight: 700; font-size: 21px; letter-spacing: -.02em; line-height: 1; }
.brand__name em { font-style: normal; color: var(--accent); }
.brand__tag {
  font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--faint); font-family: var(--font-en-display); font-weight: 600;
}
.nav__links { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.nav__link {
  padding: 9px 13px; border-radius: 999px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-2); transition: color .2s, background .2s;
}
.nav__link:hover { color: var(--ink); background: var(--surface-2); }
.nav__tools { display: flex; align-items: center; gap: 8px; margin-inline-start: 8px; }
.seg {
  display: flex; align-items: center; padding: 3px; gap: 2px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  font-family: var(--font-en-display); transition: background .2s, color .2s;
}
.seg button[data-on="1"] { background: var(--accent); color: var(--accent-ink); }
.seg--fx button { font-size: 11px; padding: 6px 9px; letter-spacing: .02em; }
.nav__burger {
  display: none; width: 44px; height: 44px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 12px; align-items: center; justify-content: center;
}
.nav__sheet {
  display: none; border-top: 1px solid var(--line); background: var(--bg-2);
  padding: 14px var(--gutter) 22px;
}
.nav__sheet a { display: block; padding: 12px 4px; border-bottom: 1px solid var(--line); font-weight: 600; }
.nav__sheet .row { display: flex; gap: 10px; margin-top: 16px; }

@media (max-width: 1080px) {
  .nav__links { display: none; }
  .nav__burger { display: flex; margin-inline-start: auto; }
  .nav.is-open .nav__sheet { display: block; }
}

/* ---------- 8. HERO ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(56px, 7vw, 96px) clamp(56px, 7vw, 92px); }
.hero__scrim {
  position: absolute; inset: -20% -10% auto; height: 150%; background: var(--scrim);
  pointer-events: none; z-index: 0;
}
.hero__grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(80% 62% at 50% 24%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(80% 62% at 50% 24%, #000 0%, transparent 78%);
}
html[data-anim="1"] .hero__grid, html[data-anim="2"] .hero__grid { opacity: .28; }
.hero__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(32px, 4.5vw, 68px); align-items: center; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
  padding: 7px 15px; border-radius: 999px; margin-bottom: 26px;
}
.hero__live { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); flex: none; }
html[data-anim="3"] .hero__live, html[data-anim="4"] .hero__live, html[data-anim="5"] .hero__live { animation: blip 1.9s ease-in-out infinite; }
@keyframes blip { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.72); } }

.hero h1 { font-size: clamp(34px, 5vw, 68px); font-weight: 800; letter-spacing: -.028em; line-height: 1.1; }
.hero h1 .hl { color: var(--accent); }
.hero h1 .dim { color: var(--muted); }
.hero__sub { margin-top: 24px; font-size: clamp(16px, 1.35vw, 19px); color: var(--ink-2); max-width: 46ch; }
.hero__sub b { color: var(--ink); font-weight: 600; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero__proof {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 30px;
  font-size: 13.5px; color: var(--muted);
}
.hero__proof span { display: inline-flex; align-items: center; gap: 8px; }
.hero__proof svg { width: 15px; height: 15px; color: var(--accent); flex: none; }

/* hero right — the "system log" visual */
.hero__panelWrap { position: relative; }
.hero__panel {
  position: relative; z-index: 2;
  background: var(--surface-solid); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden;
}
html[data-theme="dark"] .hero__panel { background: linear-gradient(180deg, rgba(16, 22, 36, .96), rgba(11, 15, 25, .98)); }
.hero__panelHead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.hero__panelHead b { font-size: 13.5px; font-weight: 700; }
.hero__panelHead small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.chip-live {
  display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  padding: 5px 10px; border-radius: 999px; font-family: var(--font-en-display);
}
.hero__log { padding: 8px 10px 6px; }
.log-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 9px; border-radius: 11px; position: relative; }
.log-row + .log-row { border-top: 1px dashed var(--line); border-radius: 0; }
.log-row__t { font-family: var(--font-en-display); font-size: 12px; color: var(--faint); font-weight: 600; width: 42px; flex: none; padding-top: 2px; }
.log-row__dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; }
.log-row[data-state="ok"] .log-row__dot { background: var(--accent); box-shadow: var(--glow); }
.log-row[data-state="wait"] .log-row__dot { background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }
.log-row__body { flex: 1; min-width: 0; }
.log-row__label { font-size: 14px; font-weight: 600; }
.log-row__meta { font-size: 11.5px; color: var(--muted); }
.hero__logFoot {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); background: var(--surface);
}
.hero__logFoot svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.hero__panelGlow {
  position: absolute; inset: auto -6% -14% -6%; height: 60%; z-index: 0; filter: blur(42px);
  background: radial-gradient(60% 100% at 50% 100%, var(--accent-soft), transparent 72%);
  pointer-events: none;
}

/* ticker */
.ticker { border-block: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.ticker__track { display: flex; gap: 0; width: max-content; }
html[data-anim="4"] .ticker__track, html[data-anim="5"] .ticker__track { animation: slide 34s linear infinite; }
.ticker__item {
  display: inline-flex; align-items: center; gap: 12px; padding: 15px 30px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
  font-family: var(--font-en-display); font-weight: 600; letter-spacing: .02em;
}
html[dir="rtl"] .ticker__item { font-family: var(--font-ar-body); }
.ticker__item::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }
@keyframes slide { to { transform: translateX(-50%); } }
html[dir="rtl"] .ticker__track { direction: ltr; }
/* The track is forced LTR so the marquee translate is unambiguous, but each
   label must keep the page direction — otherwise an Arabic item renders its
   leading number on the wrong side. */
html[dir="rtl"] .ticker__item { direction: rtl; }

@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; gap: 44px; }
  .hero__sub { max-width: none; }
}

/* ---------- 9. LANG SWITCH VISIBILITY HELPERS ---------- */
[hidden] { display: none !important; }

/* ---------- 9b. BIDI ISOLATION ----------
   Phone numbers, times and currency codes are latin-digit runs with symbols
   (+, :, /). Inside an RTL paragraph the bidi algorithm reorders them, so
   "+20 122 534 1005" renders backwards. Forcing LTR on the run and isolating
   it from the surrounding text keeps the digits in their real order. */
.num {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
html[dir="rtl"] .num { text-align: right; }

/* ---------- 10. TWEAKS: sections toggle ---------- */
html.hide-process .sec-process,
html.hide-work .sec-work,
html.hide-faq .sec-faq,
html.hide-upkeep .sec-upkeep { display: none; }
html.hide-vat .foot__note--vat { display: none; }
