/* ==========================================================================
   Aether Syntax LLC — custom layout, theming & animation styles
   Complements Tailwind (Play CDN, darkMode: 'class').
   Brand palette per Nexus_Brand_Guidelines:
   Navy #0A1F44 · Electric #1E6BF1 · Charcoal #1A1D23 · Silver #C7CDD6
   ========================================================================== */

/* ---- Hero background: light & dark variants ---- */
.hero-bg {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(30, 107, 241, 0.10), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
}

.dark .hero-bg {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(30, 107, 241, 0.22), transparent 60%),
    linear-gradient(180deg, #071734 0%, #040e22 100%);
}

/* Subtle engineering grid overlay */
.hero-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(10, 31, 68, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 31, 68, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, black 30%, transparent 75%);
  pointer-events: none;
}

.dark .hero-bg::before {
  background-image:
    linear-gradient(rgba(199, 205, 214, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(199, 205, 214, 0.045) 1px, transparent 1px);
}

/* Floating accent glow behind hero headline */
.hero-glow {
  position: absolute;
  top: 18%;
  left: 50%;
  width: min(720px, 90vw);
  height: 340px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(30, 107, 241, 0.10), transparent);
  filter: blur(60px);
  pointer-events: none;
}

.dark .hero-glow {
  background: radial-gradient(closest-side, rgba(30, 107, 241, 0.28), transparent);
}

/* CTA section glow */
.cta-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 60% at 50% 50%, rgba(30, 107, 241, 0.06), transparent 70%);
  pointer-events: none;
}

.dark .cta-glow {
  background: radial-gradient(ellipse 50% 60% at 50% 50%, rgba(30, 107, 241, 0.12), transparent 70%);
}

/* ---- Gradient headline text ---- */
.text-gradient {
  /* Light mode: Electric Blue → Deep Navy for contrast on white */
  background: linear-gradient(92deg, #1e6bf1 10%, #1356d0 55%, #0a1f44 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dark .text-gradient {
  /* Dark mode: Electric Blue → Metallic Silver */
  background: linear-gradient(92deg, #1e6bf1 10%, #4d8bf5 45%, #c7cdd6 95%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ---- Sticky header states (toggled by js/main.js) ---- */
#site-header {
  background: transparent;
}

#site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(10, 31, 68, 0.08);
  box-shadow: 0 8px 32px rgba(10, 31, 68, 0.08);
}

.dark #site-header.is-scrolled {
  background: rgba(4, 14, 34, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(4, 14, 34, 0.45);
}

/* ---- Service card hover lift ---- */
.service-card {
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
  transform: translateY(-6px);
  border-color: rgba(30, 107, 241, 0.45);
  box-shadow: 0 24px 48px -16px rgba(30, 107, 241, 0.25);
}

/* ---- Process step connector (desktop only, direction-aware) ---- */
@media (min-width: 1024px) {
  .process-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    inset-inline-end: -1.5rem;
    width: 1.5rem;
    height: 2px;
    background: linear-gradient(90deg, rgba(30, 107, 241, 0.6), rgba(30, 107, 241, 0.1));
  }

  [dir="rtl"] .process-step:not(:last-child)::after {
    background: linear-gradient(270deg, rgba(30, 107, 241, 0.6), rgba(30, 107, 241, 0.1));
  }
}

/* ---- RTL: flip directional arrow icons ---- */
[dir="rtl"] .icon-arrow {
  transform: scaleX(-1);
}

/* ---- Language switcher dropdown ---- */
.lang-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: start;
  color: inherit;
  transition: background-color 0.15s ease;
}

.lang-option:hover {
  background: rgba(10, 31, 68, 0.05);
}

.dark .lang-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lang-option.is-active {
  color: #1E6BF1;
  font-weight: 700;
}

.lang-option.is-active::after {
  content: "✓";
  font-size: 0.8rem;
}

/* ---- Per-script typography ---- */
/* Arabic: Tajawal everywhere */
html[lang="ar"] body,
html[lang="ar"] .font-display,
html[lang="ar"] .font-body {
  font-family: 'Tajawal', 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* Chinese (Simplified) */
html[lang="zh"] body,
html[lang="zh"] .font-display,
html[lang="zh"] .font-body {
  font-family: 'Noto Sans SC', 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* Japanese */
html[lang="ja"] body,
html[lang="ja"] .font-display,
html[lang="ja"] .font-body {
  font-family: 'Noto Sans JP', 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* Korean */
html[lang="ko"] body,
html[lang="ko"] .font-display,
html[lang="ko"] .font-body {
  font-family: 'Noto Sans KR', 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* Non-Latin scripts: no letter-spacing tricks */
html[lang="ar"] .tracking-tight,
html[lang="ar"] .tracking-widest,
html[lang="ar"] [class*="tracking-["],
html[lang="zh"] .tracking-tight,
html[lang="zh"] .tracking-widest,
html[lang="zh"] [class*="tracking-["],
html[lang="ja"] .tracking-tight,
html[lang="ja"] .tracking-widest,
html[lang="ja"] [class*="tracking-["],
html[lang="ko"] .tracking-tight,
html[lang="ko"] .tracking-widest,
html[lang="ko"] [class*="tracking-["] {
  letter-spacing: 0 !important;
}

/* These scripts read better with taller lines */
html[lang="ar"] p,
html[lang="ja"] p,
html[lang="ko"] p {
  line-height: 1.9;
}

/* CJK headings need a bit more room than tight Latin leading */
html[lang="zh"] h1,
html[lang="zh"] h2,
html[lang="ja"] h1,
html[lang="ja"] h2,
html[lang="ko"] h1,
html[lang="ko"] h2 {
  line-height: 1.4;
}

/* ---- Scroll-reveal animation (activated via IntersectionObserver) ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Accessibility: honour reduced-motion preference ---- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .service-card,
  .service-card:hover {
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---- Refined scrollbar on desktop ---- */
@media (min-width: 1024px) {
  ::-webkit-scrollbar { width: 10px; }

  ::-webkit-scrollbar-track { background: #f1f5f9; }
  ::-webkit-scrollbar-thumb {
    background: #c7cdd6;
    border-radius: 8px;
    border: 2px solid #f1f5f9;
  }
  ::-webkit-scrollbar-thumb:hover { background: #1e6bf1; }

  .dark ::-webkit-scrollbar-track { background: #040e22; }
  .dark ::-webkit-scrollbar-thumb {
    background: #0e2a5c;
    border: 2px solid #040e22;
  }
  .dark ::-webkit-scrollbar-thumb:hover { background: #1e6bf1; }
}

/* ---- Guard against any accidental horizontal overflow ---- */
html, body {
  overflow-x: hidden;
}

/* Long words / URLs never break layout on narrow screens */
h1, h2, h3, p, a, dd {
  overflow-wrap: break-word;
}
