/* ==========================================================================
   BOSA Omni AI — base: fonts, tokens, reset, typography, layout primitives
   All spacing uses logical properties so Arabic (RTL) works without overrides.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/InstrumentSerif-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/InstrumentSerif-Italic-ext.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/PlexArabic-300.woff2") format("woff2"); font-weight: 300; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/PlexArabic-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/PlexArabic-500.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/PlexArabic-600.woff2") format("woff2"); font-weight: 600 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

:root {
  /* Night navy scale */
  --bg-0: #03060d;
  --bg-1: #060c18;
  --bg-2: #0a1424;
  --bg-3: #0f1d33;
  --line: rgba(160, 190, 235, 0.12);
  --line-strong: rgba(160, 190, 235, 0.22);

  --text: #eef3fb;
  --text-2: #b8c5d9;
  --text-3: #7d8ca5;

  /* Brand */
  --navy: #0f3a68;
  --blue: #1f6fd1;
  --blue-2: #3d8bff;
  --ice: #cfe2ff;
  --ice-2: #eaf2ff;
  --gold: #f0a91e;
  --gold-2: #ffc95a;
  --gold-3: #ffe3a3;
  --amber: #d98a0b;
  --danger: #ff7668;
  --success: #5fe0a4;

  --grad-brand: linear-gradient(120deg, var(--blue-2), var(--ice) 45%, var(--gold-2));
  --grad-gold: linear-gradient(120deg, var(--gold-2), var(--gold) 60%, var(--amber));
  --grad-ice: linear-gradient(180deg, #ffffff, var(--ice) 70%, #9cc1f5);

  --glass: rgba(18, 32, 56, 0.45);
  --glass-strong: rgba(22, 40, 70, 0.66);
  --glass-border: rgba(207, 226, 255, 0.14);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 40px 120px -30px rgba(0, 0, 0, 0.75);
  --glow-gold: 0 0 0 1px rgba(255, 201, 90, 0.35), 0 10px 40px -10px rgba(240, 169, 30, 0.55);
  --glow-blue: 0 0 0 1px rgba(61, 139, 255, 0.35), 0 10px 40px -10px rgba(31, 111, 209, 0.55);

  --radius-xs: 8px;
  --radius-s: 12px;
  --radius-m: 18px;
  --radius-l: 28px;
  --radius-xl: 40px;
  --radius-pill: 999px;

  --font-sans: "Geist", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: "Geist Mono", "IBM Plex Sans Arabic", ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;

  --fs-display: clamp(48px, 8.2vw, 128px);
  --fs-h1: clamp(40px, 6vw, 88px);
  --fs-h2: clamp(32px, 4.4vw, 64px);
  --fs-h3: clamp(22px, 2.2vw, 30px);
  --fs-lead: clamp(17px, 1.5vw, 21px);
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-micro: 12px;

  --container: 1240px;
  --container-wide: 1440px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-y: clamp(88px, 12vw, 180px);
  --header-h: 72px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur: 320ms;
  --dur-slow: 700ms;

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  /* The page background lives on <html> so fixed WebGL layers (z-index:-1) can sit between it and the content. */
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(31, 111, 209, 0.14), transparent 60%),
    radial-gradient(900px 600px at -10% 10%, rgba(240, 169, 30, 0.06), transparent 60%),
    var(--bg-0);
  background-color: var(--bg-0);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  color: var(--text-2);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
[dir="rtl"] body { line-height: 1.75; }

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
a:not([class]) { text-decoration: underline; text-decoration-color: rgba(207, 226, 255, 0.35); text-underline-offset: 3px; }
a:not([class]):hover { text-decoration-color: var(--gold-2); color: var(--text); }
p, h1, h2, h3, h4, h5, h6, figure, blockquote, dl, dd { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }
:where(p) code { padding: 0.1em 0.4em; border-radius: 6px; background: rgba(207, 226, 255, 0.08); color: var(--ice); }
::selection { background: rgba(240, 169, 30, 0.35); color: #fff; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, .display, .h1, .h2, .h3 {
  color: var(--text);
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 1;
  text-wrap: balance;
}
.display { font-size: var(--fs-display); letter-spacing: -0.045em; line-height: 0.95; font-weight: 300; }
.h1 { font-size: var(--fs-h1); line-height: 0.98; }
.h2 { font-size: var(--fs-h2); line-height: 1.02; }
.h3 { font-size: var(--fs-h3); line-height: 1.15; letter-spacing: -0.02em; font-weight: 400; }
.h4 { font-size: 18px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 500; color: var(--text); }
[dir="rtl"] :is(h1, h2, h3, h4, .display, .h1, .h2, .h3) { letter-spacing: 0; line-height: 1.2; font-weight: 400; }
:lang(zh-Hans) :is(h1, h2, h3, .display, .h1, .h2, .h3) { letter-spacing: 0; line-height: 1.15; font-weight: 400; }

.lead { font-size: var(--fs-lead); line-height: 1.55; color: var(--text-2); text-wrap: pretty; max-width: 62ch; }
.small { font-size: var(--fs-small); }
.muted { color: var(--text-3); }
.text-strong { color: var(--text); }
strong { color: var(--text); font-weight: 500; }
.mono { font-family: var(--font-mono); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 450;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow--gold { color: var(--gold-2); }
.eyebrow--ice { color: var(--ice); }
[dir="rtl"] .eyebrow, :lang(zh-Hans) .eyebrow { letter-spacing: 0.02em; }

/* Accent words: serif italic with a gold gradient */
.accent, em.accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  padding-inline-end: 0.06em;
  background: linear-gradient(100deg, var(--gold-3) 0%, var(--gold-2) 35%, var(--gold) 70%, var(--amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[dir="rtl"] .accent, :lang(zh-Hans) .accent { font-family: inherit; font-style: normal; font-weight: 500; }
.gradient-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.ice-text {
  background: var(--grad-ice);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: calc(var(--container-wide) + var(--gutter) * 2); }
.container--narrow { max-width: calc(820px + var(--gutter) * 2); }

.section { position: relative; padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.section--flush-top { padding-block-start: 0; }

.stack { display: flex; flex-direction: column; gap: var(--stack-gap, 20px); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, 12px); }
.center { text-align: center; margin-inline: auto; }
.center .lead { margin-inline: auto; }

.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--grid-gap, clamp(16px, 2vw, 24px)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}
.split--wide-end { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
@media (max-width: 900px) {
  .split, .split--wide-end { grid-template-columns: minmax(0, 1fr); }
}

.hairline { height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong) 20%, var(--line-strong) 80%, transparent); border: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.flip-rtl { transition: transform var(--dur) var(--ease-out); }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

.skip-link {
  position: fixed;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--gold);
  color: #1a1204;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus-visible { transform: none; }
main:focus { outline: none; }

/* Pre-reveal state (only when JS is running — see BOOT_SCRIPT). */
.js [data-reveal]:not(.is-in),
.js [data-reveal-stagger]:not(.is-in) > * { opacity: 0; }
.js [data-split]:not(.is-split):not(.is-in) { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal]:not(.is-in),
  .js [data-reveal-stagger]:not(.is-in) > *,
  .js [data-split]:not(.is-split):not(.is-in) { opacity: 1; }
}

/* Split headings (anime.js splitText wraps each word in a clipping span) */
/* clip only vertically (words rise from below) — italic serif overhang and descenders stay visible */
.is-split span:has(> .split-word) { display: inline-block; vertical-align: top; overflow: visible clip !important; padding-block: 0.12em 0.24em; margin-block: -0.12em -0.24em; }
.split-word, .split-char { display: inline-block; will-change: transform; }
/* Keep the gold accent gradient on split words (background-clip does not reach inline-block children) */
.accent span { background-image: inherit; -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Arabic script must never be letter-spaced (it breaks letter joining) — overrides every component */
:lang(ar), :lang(ar) * { letter-spacing: 0 !important; }

/* Chinese: break at punctuation/spaces first; only split inside a phrase when it cannot fit at all */
:lang(zh-Hans) :is(h1, h2, h3, h4, .display, .h1, .h2, .h3, .h4, .lead, .card__title, .btn) { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; text-wrap: pretty; }

/* Code, terminals and raw error messages stay left-to-right inside RTL pages;
   each line picks its own direction so translated lines still read naturally. */
:is(pre, code, kbd, .demo-terminal__screen, .home-wall__errors) { direction: ltr; unicode-bidi: isolate; }
.demo-terminal__log > * { unicode-bidi: plaintext; text-align: start; }
