/* ==========================================================================
   base.css — reset, typography, layout primitives, motion foundation
   All directional properties are LOGICAL so RTL needs no overrides.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 6rem;
}

body {
  min-block-size: 100dvh;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--t-base) var(--ease-out),
              color var(--t-base) var(--ease-out);
}

img, picture, video, canvas, svg {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; padding: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; padding: 0; }

/* ---- Focus: never removed, only restyled ------------------------------- */
:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  inset-block-start: -100%;
  inset-inline-start: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-5);
  /* Navy on white, not gold: near-black on --gold-deep is only 3.9:1 */
  background: var(--navy-900);
  color: #FFFFFF;
  font-weight: 600;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: inset-block-start var(--t-fast) var(--ease-out);
}
.skip-link:focus { inset-block-start: 0; }

.sr-only {
  position: absolute;
  inline-size: 1px; block-size: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); line-height: var(--lh-snug); }
h3 { font-size: var(--fs-xl); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-lg); line-height: var(--lh-snug); }

p { text-wrap: pretty; }

/* NOTE: ch-based measures must sit on the element that carries the display
   font, never on a wrapper — a wrapper measures against the 16px body font
   and crushes the headline. */
.measure    { max-inline-size: var(--measure); }
.measure-sm { max-inline-size: 46ch; }
.measure-xs { max-inline-size: 34ch; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent);
}
html[lang="ar"] .eyebrow { text-transform: none; }

.eyebrow::before {
  content: "";
  inline-size: 2.25rem;
  block-size: 2px;
  background: var(--accent);
  flex: none;
}

.lede {
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--ink-soft);
}

.section-title { margin-block-end: var(--space-4); }

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-block-end: var(--space-7);
}

/* Tabular figures stop stat counters jittering as they tick up */
.tabular { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Layout primitives
   ========================================================================== */
.container {
  inline-size: 100%;
  max-inline-size: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-inline-size: var(--container-wide); }

.section { padding-block: var(--section-y); }
.section--sunk { background: var(--surface-sunk); }
.section--tight { padding-block: calc(var(--section-y) * .62); }

.section--dark {
  background:
    radial-gradient(120% 100% at 88% 0%, rgba(30,58,138,.5) 0%, transparent 62%),
    linear-gradient(180deg, #0C1526 0%, #070C16 100%);
}

/* Explicit column counts, not auto-fit. auto-fit derives the count from a
   minimum track width, so widening the container silently changed 3-across
   into 5-across and orphaned the sixth card. Column counts are a layout
   decision — state them. */
.grid { display: grid; gap: var(--space-5); }

.grid-2, .grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 40rem) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.split {
  display: grid;
  gap: clamp(var(--space-6), 4vw, var(--space-8));
  align-items: center;
}
@media (min-width: 62rem) {
  .split { grid-template-columns: 1fr 1fr; }
  .split--wide-start { grid-template-columns: 1.15fr .85fr; }
  .split--wide-end   { grid-template-columns: .85fr 1.15fr; }
}

.stack { display: flex; flex-direction: column; }
.stack-2 { gap: var(--space-2); }
.stack-3 { gap: var(--space-3); }
.stack-4 { gap: var(--space-4); }
.stack-5 { gap: var(--space-5); }
.stack-6 { gap: var(--space-6); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.flow > * + * { margin-block-start: var(--space-4); }

/* ==========================================================================
   Scroll reveals
   The hidden state is gated on html.js AND html.reveal-ready. If JS or
   IntersectionObserver never runs, content is simply visible — copy can
   never be stuck invisible.
   ========================================================================== */
.reveal { --reveal-shift: 22px; }

html.js.reveal-ready .reveal {
  opacity: 0;
  transform: translate3d(0, var(--reveal-shift), 0);
  transition:
    opacity var(--t-reveal) var(--ease-out),
    transform var(--t-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

html.js.reveal-ready .reveal.is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

/* Directional variants flip sign under RTL.

   Scoped to the breakpoint where the two-column split layouts exist. Below it
   the columns stack, so a horizontal slide has nothing to play against — and
   it actively breaks the page: an element already at the container edge,
   translated 1.6 x 22px outward, pokes ~18px past a phone viewport.
   body's overflow-x:hidden clips the pixels, but a pinch-zoomed mobile
   viewport can still pan onto the unpainted strip beside them. It reads as a
   blank band down the inline-end edge (right in EN, left in AR) that
   mysteriously heals once a scroll fires the reveal and the transform
   returns to 0.

   Below 62rem these fall through to the plain vertical .reveal above. */
@media (min-width: 62rem) {
  html.js.reveal-ready .reveal--start {
    transform: translate3d(calc(var(--reveal-shift) * -1.6 * var(--dir-sign, 1)), 0, 0);
  }
  html.js.reveal-ready .reveal--end {
    transform: translate3d(calc(var(--reveal-shift) * 1.6 * var(--dir-sign, 1)), 0, 0);
  }
}
html.js.reveal-ready .reveal--scale { transform: scale(.955); }

html.js.reveal-ready .reveal--start.is-in,
html.js.reveal-ready .reveal--end.is-in { transform: translate3d(0, 0, 0); }
html.js.reveal-ready .reveal--scale.is-in { transform: scale(1); }

html[dir="rtl"] { --dir-sign: -1; }

/* Stagger — 70ms per item, inside Material's 30-50ms-per-item guidance
   once the eased overlap is accounted for. */
.stagger > * { --reveal-delay: 0ms; }
.stagger > :nth-child(2) { --reveal-delay: 70ms; }
.stagger > :nth-child(3) { --reveal-delay: 140ms; }
.stagger > :nth-child(4) { --reveal-delay: 210ms; }
.stagger > :nth-child(5) { --reveal-delay: 280ms; }
.stagger > :nth-child(6) { --reveal-delay: 350ms; }
.stagger > :nth-child(7) { --reveal-delay: 420ms; }
.stagger > :nth-child(8) { --reveal-delay: 490ms; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  html.js.reveal-ready .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.relative { position: relative; }
.full-bleed-media {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}
