/**
 * Sovereign Intelligence — global design system for public pages (body.mg-public).
 * Load after Bootstrap, design-system, design-tokens, public.css, institutional-foundation.
 */

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  /* Brand colors — aligned to institutional foundation / design-tokens */
  --navy-950: #060d16;
  --navy-900: #0a1628; /* dark surface (heroes); not the brand navy label */
  --navy-800: var(--color-navy, #0d2137);
  --navy-700: #142d4c;
  --navy-600: var(--color-navy-light, #1a3a5c);
  --navy-400: #2e6096;

  --teal-600: var(--color-teal-dark, #0a5a85);
  --teal-500: var(--color-teal, #0a6fa3);
  --teal-400: #4cc3f0;
  --teal-300: #8fd8f5;
  --teal-100: #d3ecf8;
  --teal-50: #eef7fc;

  --gold-500: #c9921a;
  --gold-400: #e0a820;
  --gold-300: #f0c040;
  --gold-100: #fdf3d0;

  /* Page backgrounds */
  --bg-dark: #060d16;
  --bg-navy: #0a1628;
  --bg-light: #f5f7f9; /* match --p95-canvas */
  --bg-white: #ffffff;
  --bg-warm: #fafaf8;

  /* Text */
  --text-inverse: #ffffff;
  --text-primary: #0a1628;
  --text-secondary: #4a5568;
  --text-muted: #5f6b7a;
  --text-teal: #0a6fa3;
  --text-gold: #c9921a;

  /* UI */
  --border-light: #e8ecf0;
  --border-dark: rgba(255, 255, 255, 0.1);
  --shadow-card: 0 4px 24px rgba(10, 22, 40, 0.08);
  --shadow-float: 0 20px 60px rgba(10, 22, 40, 0.16);

  /* Typography (Sovereign stack) */
  --font-display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-arabic: "Noto Sans Arabic", system-ui, sans-serif;

  /* Spacing */
  --section-py: 100px;
  --container: 1200px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
}

@media (max-width: 768px) {
  :root {
    --section-py: 60px;
  }
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Intentionally no universal margin/padding reset — preserves Bootstrap/forms */

/* ── Base (public site only) ─────────────────────────────────── */
[dir="rtl"] body.mg-public {
  font-family: var(--font-arabic), var(--font-body);
  letter-spacing: 0;
}

body.mg-public {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-white);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body.mg-public h1,
body.mg-public h2,
body.mg-public h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: inherit;
}

/* Arabic/French RTL: display fonts break cursive Arabic — use body/Arabic stack */
[dir="rtl"] body.mg-public h1,
[dir="rtl"] body.mg-public h2,
[dir="rtl"] body.mg-public h3,
[dir="rtl"] body.mg-public h4,
[dir="rtl"] body.mg-public h5,
[dir="rtl"] body.mg-public h6 {
  font-family: var(--font-arabic), var(--font-body);
  letter-spacing: 0;
  text-transform: none;
}

body.mg-public h1 {
  font-size: clamp(44px, 6vw, 80px);
}

body.mg-public h2 {
  font-size: clamp(32px, 4vw, 56px);
}

body.mg-public h3 {
  font-size: clamp(22px, 3vw, 32px);
}

body.mg-public main p {
  max-width: 68ch;
}

/* Numbers / stats — add class where needed */
body.mg-public .mg-data,
body.mg-public .stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Layout container — align marketing shell to 1200px cap */
body.mg-public .container:not(.container-fluid) {
  max-width: min(var(--container), 100%);
  margin-left: auto;
  margin-right: auto;
  padding-left: 40px;
  padding-right: 40px;
}

@media (max-width: 768px) {
  body.mg-public .container:not(.container-fluid) {
    padding-left: 20px;
    padding-right: 20px;
  }
}

body.mg-public .sov-section {
  padding-block: var(--section-py);
}

/* ── Buttons (Bootstrap-compatible; scoped to public body) ─── */
body.mg-public .btn.mg-language-toggle {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  gap: 0.35rem;
}

body.mg-public .btn:not(.mg-language-toggle):not(.navbar-toggler) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

body.mg-public .btn.btn-sm:not(.mg-language-toggle) {
  padding: 10px 20px;
  font-size: 13px;
}

body.mg-public .btn.btn-lg:not(.mg-language-toggle) {
  padding: 18px 36px;
  font-size: 16px;
}

body.mg-public .btn-primary,
body.mg-public .btn-mg-primary {
  background: var(--teal-500) !important;
  color: var(--text-inverse) !important;
  border-color: transparent !important;
  box-shadow: 0 4px 20px rgba(10, 111, 163, 0.35);
}

body.mg-public .btn-primary:hover,
body.mg-public .btn-mg-primary:hover {
  background: var(--teal-400) !important;
  color: var(--text-inverse) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(10, 111, 163, 0.45);
}

body.mg-public .btn-gold {
  background: var(--gold-400);
  color: var(--navy-900);
  box-shadow: 0 4px 20px rgba(224, 168, 32, 0.35);
}

body.mg-public .btn-gold:hover {
  background: var(--gold-300);
  transform: translateY(-2px);
  color: var(--navy-900);
}

body.mg-public .btn-outline-white,
body.mg-public .btn-mg-outline-light {
  background: transparent !important;
  color: var(--text-inverse) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
  backdrop-filter: blur(8px);
}

body.mg-public .btn-outline-white:hover,
body.mg-public .btn-mg-outline-light:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  color: var(--text-inverse) !important;
  transform: translateY(-2px);
}

body.mg-public .btn-mg-white {
  background: var(--bg-white) !important;
  color: var(--navy-900) !important;
  border: none !important;
}

body.mg-public .btn-outline-navy {
  background: transparent;
  color: var(--navy-800);
  border: 1.5px solid var(--navy-800);
}

body.mg-public .btn-outline-navy:hover {
  background: var(--navy-800);
  color: var(--text-inverse);
  transform: translateY(-2px);
}

body.mg-public .btn-outline-primary {
  color: var(--teal-600) !important;
  border-color: var(--teal-500) !important;
  background: transparent !important;
}

body.mg-public .btn-outline-primary:hover {
  background: var(--teal-500) !important;
  color: var(--text-inverse) !important;
  transform: translateY(-2px);
}

body.mg-public .btn-arrow::after {
  content: "→";
  display: inline-block;
  transition: transform 0.2s ease;
  margin-inline-start: 2px;
}

body.mg-public .btn-arrow:hover::after {
  transform: translateX(4px);
}

/* ── Section label ───────────────────────────────────────────── */
body.mg-public .section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-500);
  margin-bottom: 16px;
}

body.mg-public .section-label::before {
  content: "";
  display: block;
  width: 24px;
  height: 2px;
  background: var(--teal-500);
  border-radius: 1px;
}

body.mg-public .section-label-gold {
  color: var(--gold-400);
}

body.mg-public .section-label-gold::before {
  background: var(--gold-400);
}

body.mg-public .section-label-white {
  color: rgba(255, 255, 255, 0.7);
}

body.mg-public .section-label-white::before {
  background: rgba(255, 255, 255, 0.4);
}

/* ── Geometric texture ───────────────────────────────────────── */
body.mg-public .geo-pattern {
  position: relative;
  overflow: hidden;
}

body.mg-public .geo-pattern::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}

body.mg-public .geo-pattern-teal::before {
  background-image: radial-gradient(circle at 1px 1px, rgba(10, 111, 163, 0.12) 1px, transparent 0);
}

/* ── Scroll reveal (always visible: hidden “reveal” caused huge blank scroll areas) ─ */
body.mg-public .reveal {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

body.mg-public .reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

body.mg-public .reveal-delay-1 {
  transition-delay: 0.1s;
}

body.mg-public .reveal-delay-2 {
  transition-delay: 0.2s;
}

body.mg-public .reveal-delay-3 {
  transition-delay: 0.3s;
}

body.mg-public .reveal-delay-4 {
  transition-delay: 0.4s;
}

@media (prefers-reduced-motion: reduce) {
  body.mg-public .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  body.mg-public .reveal-delay-1,
  body.mg-public .reveal-delay-2,
  body.mg-public .reveal-delay-3,
  body.mg-public .reveal-delay-4 {
    transition-delay: 0s;
  }

  body.mg-public .btn:not(.mg-language-toggle):not(.navbar-toggler):hover {
    transform: none;
  }
}

/* Dark / gradient heroes: public.css + inherit rules force navy headings that vanish
   on blue/dark bands. Keep light heroes (pricing / features / trust) untouched. */
body.mg-public .mg-seo-hero--blue-gradient {
  background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

body.mg-public .mg-seo-hero,
body.mg-public .p95-hero,
body.mg-public .p95-page-hero--dark,
body.mg-public .mg-page-header,
body.mg-public .samples-page-hero,
body.mg-public .blog-hero,
body.mg-public .mg-section-gradient,
body.mg-public .mg-cta,
body.mg-public .feat-page-cta,
body.mg-public section.hero.mg-hero-command,
body.mg-public section.bg-primary,
body.mg-public section.bg-dark,
body.mg-public .hero.bg-primary,
body.mg-public .hero.bg-dark {
  color: #fff;
}

body.mg-public .mg-seo-hero h1,
body.mg-public .mg-seo-hero h2,
body.mg-public .mg-seo-hero h3,
body.mg-public .mg-seo-hero h4,
body.mg-public .mg-seo-hero h5,
body.mg-public .mg-seo-hero h6,
body.mg-public .mg-seo-hero .lead,
body.mg-public .p95-hero h1,
body.mg-public .p95-hero h2,
body.mg-public .p95-hero h3,
body.mg-public .p95-hero .hero-headline,
body.mg-public .p95-hero .hero-subhead,
body.mg-public .p95-hero .lead,
body.mg-public .p95-page-hero--dark h1,
body.mg-public .p95-page-hero--dark h2,
body.mg-public .p95-page-hero--dark h3,
body.mg-public .p95-page-hero--dark .lead,
body.mg-public .p95-page-hero--dark .p95-hero__lead,
body.mg-public .p95-page-hero--dark .p95-hero__title,
body.mg-public .mg-page-header h1,
body.mg-public .mg-page-header h2,
body.mg-public .mg-page-header h3,
body.mg-public .mg-page-header .lead,
body.mg-public .mg-page-header .about-hero-lead,
body.mg-public .mg-page-header > .container > p,
body.mg-public .samples-page-hero h1,
body.mg-public .samples-page-hero h2,
body.mg-public .samples-page-hero h3,
body.mg-public .samples-page-hero .lead,
body.mg-public .blog-hero h1,
body.mg-public .blog-hero h2,
body.mg-public .blog-hero h3,
body.mg-public .blog-hero .lead,
body.mg-public .mg-section-gradient h1,
body.mg-public .mg-section-gradient h2,
body.mg-public .mg-section-gradient h3,
body.mg-public .mg-cta h1,
body.mg-public .mg-cta h2,
body.mg-public .mg-cta h3,
body.mg-public .feat-page-cta h1,
body.mg-public .feat-page-cta h2,
body.mg-public .feat-page-cta h3,
body.mg-public section.hero.mg-hero-command h1,
body.mg-public section.hero.mg-hero-command .hero-headline,
body.mg-public section.hero.mg-hero-command .hero-subhead,
body.mg-public section.bg-primary h1,
body.mg-public section.bg-primary h2,
body.mg-public section.bg-primary h3,
body.mg-public section.bg-primary .lead,
body.mg-public section.bg-dark h1,
body.mg-public section.bg-dark h2,
body.mg-public section.bg-dark h3,
body.mg-public section.bg-dark .lead,
body.mg-public .hero.bg-primary h1,
body.mg-public .hero.bg-primary .lead,
body.mg-public .hero.bg-dark h1,
body.mg-public .hero.bg-dark .lead {
  color: #fff !important;
}

body.mg-public .mg-seo-hero .text-muted,
body.mg-public .p95-hero .text-muted,
body.mg-public .p95-page-hero--dark .text-muted,
body.mg-public .mg-page-header .text-muted,
body.mg-public .samples-page-hero .text-muted,
body.mg-public .blog-hero .text-muted,
body.mg-public .mg-section-gradient .text-muted,
body.mg-public .mg-cta .text-muted,
body.mg-public .feat-page-cta .text-muted,
body.mg-public section.bg-primary .text-muted,
body.mg-public section.bg-dark .text-muted,
body.mg-public .mg-seo-hero .text-white-50,
body.mg-public .p95-page-hero--dark .text-white-50,
body.mg-public .mg-page-header .text-white-50,
body.mg-public .samples-page-hero .samples-hero-note {
  color: rgba(255, 255, 255, 0.82) !important;
}

/* Long FR / AR hero copy: measure + line-height; RTL avoids clipped glyphs */
body.mg-public .mg-page-header h1,
body.mg-public .p95-page-hero--dark h1,
body.mg-public .samples-page-hero h1,
body.mg-public .blog-hero h1,
body.mg-public .mg-seo-hero h1,
body.mg-public .p95-hero .hero-headline {
  max-width: min(42rem, 100%);
  line-height: 1.2;
  text-wrap: balance;
  overflow-wrap: break-word;
}

body.mg-public .mg-page-header .lead,
body.mg-public .mg-page-header .about-hero-lead,
body.mg-public .mg-page-header > .container > p:not(.p95-hero__actions):not(.section-label),
body.mg-public .p95-page-hero--dark .lead,
body.mg-public .p95-page-hero--dark > .container > p:not(.p95-hero__actions):not(.section-label),
body.mg-public .samples-page-hero .lead,
body.mg-public .mg-seo-hero .lead,
body.mg-public .p95-hero .hero-subhead {
  max-width: min(40rem, 100%);
  line-height: 1.55;
  overflow-wrap: break-word;
}

[dir="rtl"] body.mg-public .mg-page-header h1,
[dir="rtl"] body.mg-public .p95-page-hero--dark h1,
[dir="rtl"] body.mg-public .samples-page-hero h1,
[dir="rtl"] body.mg-public .blog-hero h1,
[dir="rtl"] body.mg-public .mg-seo-hero h1,
[dir="rtl"] body.mg-public .p95-hero .hero-headline,
html[lang="ar"] body.mg-public .mg-page-header h1,
html[lang="ar"] body.mg-public .p95-page-hero--dark h1,
html[lang="ar"] body.mg-public .samples-page-hero h1,
html[lang="ar"] body.mg-public .mg-seo-hero h1 {
  letter-spacing: 0;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

/* Hero CTAs: wrap long FR labels; clear focus on dark bands */
body.mg-public .mg-page-header .p95-hero__actions .btn,
body.mg-public .p95-page-hero--dark .p95-hero__actions .btn,
body.mg-public .samples-page-hero .p95-hero__actions .btn,
body.mg-public .mg-seo-hero .btn,
body.mg-public .p95-hero .p95-hero__actions .btn {
  white-space: normal;
  max-width: 100%;
  height: auto;
  line-height: 1.35;
  text-align: center;
}

body.mg-public .mg-page-header a:focus-visible,
body.mg-public .p95-page-hero--dark a:focus-visible,
body.mg-public .samples-page-hero a:focus-visible,
body.mg-public .mg-seo-hero a:focus-visible,
body.mg-public .p95-hero a:focus-visible,
body.mg-public .mg-page-header button:focus-visible,
body.mg-public .p95-page-hero--dark button:focus-visible,
body.mg-public .samples-page-hero button:focus-visible,
body.mg-public .p95-hero button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
