/* Branch — Predictable Growth Systems
   Tokens, base type, and shared primitives. */

:root {
  /* Brand palette */
  --navy: #0B1420;
  --navy-2: #0F1A2A;
  --graphite: #1F2933;
  --graphite-2: #182230;
  --silver: #D9E1E8;
  --silver-2: #B7C2CE;
  --soft-white: #F8FAFC;
  --teal: #00C2B8;
  --teal-2: #2BD8CE;
  --teal-glow: rgba(0, 194, 184, 0.18);
  --gold: #C8A96B;
  --gold-2: #DCC18A;

  /* Semantic accent — flips with Tweak */
  --accent: var(--teal);
  --accent-2: var(--teal-2);
  --accent-glow: var(--teal-glow);

  /* Surface tokens */
  --bg: var(--navy);
  --surface: var(--graphite);
  --surface-2: var(--graphite-2);
  --hairline: rgba(217, 225, 232, 0.10);
  --hairline-strong: rgba(217, 225, 232, 0.18);
  --text: var(--soft-white);
  --text-mute: var(--silver);
  --text-dim: rgba(217, 225, 232, 0.55);

  /* Type */
  --f-display: "IBM Plex Sans Arabic", "Space Grotesk", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --f-en: "Space Grotesk", "Inter", system-ui, sans-serif;

  /* Density (overridable by Tweak) */
  --section-pad-y: 140px;
  --container-pad-x: 56px;
  --gap: 24px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 20px;
}

[data-density="compact"] {
  --section-pad-y: 96px;
  --container-pad-x: 40px;
  --gap: 16px;
}
[data-density="spacious"] {
  --section-pad-y: 180px;
  --container-pad-x: 72px;
  --gap: 32px;
}

[data-accent="gold"] {
  --accent: var(--gold);
  --accent-2: var(--gold-2);
  --accent-glow: rgba(200, 169, 107, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Selection */
::selection { background: var(--accent); color: var(--navy); }

/* Containers + sections */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: var(--container-pad-x);
  padding-right: var(--container-pad-x);
}
.section {
  padding-top: var(--section-pad-y);
  padding-bottom: var(--section-pad-y);
  position: relative;
}
.section--light {
  background: var(--soft-white);
  color: #0B1420;
}
.section--light .text-mute { color: rgba(11, 20, 32, 0.6); }
.section--light .hairline { background: rgba(11, 20, 32, 0.12); }

/* Typography */
.display {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.18;
  text-wrap: balance;
}
.h1 { font-size: clamp(34px, 5.2vw, 68px); }
.h2 { font-size: clamp(28px, 3.6vw, 48px); }
.h3 { font-size: clamp(22px, 2.2vw, 28px); }
.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}
.eyebrow {
  direction: ltr;
}
.eyebrow.eyebrow-ar { direction: rtl; font-family: var(--f-body); letter-spacing: 0; text-transform: none; font-size: 12px; font-weight: 500; }
.eyebrow.eyebrow-ar::before { display: none; }
.eyebrow.eyebrow-ar::after { content: ""; width: 22px; height: 1px; background: var(--accent); margin-inline-start: 10px; flex-shrink: 0; }
.eyebrow--no-rule::before { display: none; }

.lede {
  font-size: clamp(17px, 1.4vw, 20px);
  color: var(--text-mute);
  line-height: 1.55;
  max-width: 60ch;
  text-wrap: pretty;
}
.text-mute { color: var(--text-dim); }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum"; direction: ltr; unicode-bidi: isolate; }
.tabnum { font-variant-numeric: tabular-nums; }

/* Hairlines */
.hairline {
  height: 1px;
  background: var(--hairline);
  width: 100%;
}
.hairline-v {
  width: 1px;
  background: var(--hairline);
  align-self: stretch;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border-radius: 4px;
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: var(--navy);
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--hairline-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); font-family: var(--f-mono); font-size: 12px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.btn-arrow svg { transition: transform 0.2s ease; }
.btn-arrow:hover svg { transform: translateX(4px); }

/* Tag/Pill */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}
.tag .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 28px;
}

/* Grid helpers */
.grid { display: grid; gap: var(--gap); }
.flex { display: flex; gap: var(--gap); }

/* Utility scrollbar hiding for ticker */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Section ID label */
.sid {
  position: absolute;
  top: 28px;
  left: var(--container-pad-x);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
  direction: ltr;
}
.section--light .sid { color: rgba(11, 20, 32, 0.45); }

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in { opacity: 1; transform: none; }

/* Marquee */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Subtle grid background */
.grid-bg {
  background-image:
    linear-gradient(to right, var(--hairline) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hairline) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* Glow */
.glow-teal {
  box-shadow: 0 0 0 1px var(--accent-glow), 0 16px 60px var(--accent-glow);
}

/* Sparkline */
.spark path { stroke-linecap: round; stroke-linejoin: round; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─────────────────────────── MOBILE RESPONSIVE ─────────────────────────── */

/* Tablet ↓ */
@media (max-width: 1024px) {
  :root {
    --section-pad-y: 100px;
    --container-pad-x: 32px;
  }
  /* 8-stage pipeline + dense module grids — collapse to denser packs */
  [style*="repeat(8,"] { grid-template-columns: repeat(4, 1fr) !important; row-gap: 24px !important; }
  [style*="repeat(4,"] { grid-template-columns: repeat(2, 1fr) !important; row-gap: 24px !important; }
}

/* Mobile breakpoint */
@media (max-width: 760px) {
  :root {
    --section-pad-y: 72px;
    --container-pad-x: 20px;
    --gap: 16px;
  }
  [data-density="compact"]  { --section-pad-y: 56px; --container-pad-x: 16px; --gap: 12px; }
  [data-density="spacious"] { --section-pad-y: 96px; --container-pad-x: 24px; --gap: 20px; }

  body { font-size: 15px; }
  .h1 { font-size: clamp(34px, 9vw, 48px) !important; line-height: 1.05; }
  .h2 { font-size: clamp(26px, 7vw, 38px) !important; line-height: 1.1; }
  .h3 { font-size: clamp(20px, 5.5vw, 26px) !important; }
  .lede { font-size: 16px !important; }

  /* Force every inline multi-column grid to single column */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  [style*="repeat(3,"] { grid-template-columns: 1fr !important; }
  [style*="repeat(4,"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="repeat(8,"] { grid-template-columns: repeat(2, 1fr) !important; row-gap: 20px !important; }

  /* Stacked CTAs */
  .btn { width: 100%; justify-content: center; }

  /* Section ID badge — inline above title instead of absolute */
  .sid { position: static !important; display: block; margin-bottom: 16px; right: auto !important; top: auto !important; }

  /* Cards & containers */
  .card { padding: 20px; }

  /* Globe + canvas */
  canvas { max-width: 100% !important; height: auto !important; }
  [style*="width: 520px"][style*="height: 520px"] {
    width: min(88vw, 420px) !important;
    height: min(88vw, 420px) !important;
  }

  /* Hide vertical hairline rules that don't make sense stacked */
  .hairline-v { display: none; }

  /* Borders on grid items — collapse weird right borders on the stacked version */
  [style*="borderRight"] { border-right: none !important; }

  /* Comparison table (positioning) — restore an inner divider */
  [style*="grid-template-columns: 1fr 1fr"][style*="borderRadius"] > *:first-child {
    border-bottom: 1px solid var(--hairline);
  }
}

/* Small phones */
@media (max-width: 420px) {
  :root { --container-pad-x: 16px; }
  .h1 { font-size: clamp(30px, 9.5vw, 40px) !important; }
  .h2 { font-size: clamp(24px, 7.5vw, 32px) !important; }
}
