/* ═══════════════════════════════════════════════════════════════════════════
   D STATION — DESIGN SYSTEM  (white-premium cinematic)
   ---------------------------------------------------------------------------
   The single shared token + utility layer. Every page links this FIRST, then
   adds page-local <style> for section-specific work. Built by Nova.

   Identity: bright, airy, luminous. Charcoal ink on a near-white base tinted
   a hair toward Saudi-blue (NOT warm cream — that is the saturated AI tell).
   Saudi-blue is the one trust accent; sand/gold is a rare warm highlight (<5%
   of any view). Restraint = premium. Generous whitespace, slow confident motion.

   Signature motif: a precision data-grid / lineage-line layer laid over the
   organic city = "governance = order over chaos." See §MOTIF.

   Color space: OKLCH (with hex/rgb fallbacks inlined where browser support of
   the property itself — not the value — could matter). All values AA-checked.
═══════════════════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────────────────
   1 · TOKENS
─────────────────────────────────────────────────────────────────────────── */
:root {
  /* ── Surface ramp · near-white tinted a hair toward blue (chroma 0.004–0.01) ── */
  --ds-bg:            oklch(99.2% 0.004 250);   /* page base — luminous off-white */
  --ds-bg-2:          oklch(98.0% 0.006 250);   /* alternating section band      */
  --ds-surface:       oklch(100% 0 0);          /* pure-white cards / panels     */
  --ds-surface-sunk:  oklch(97.2% 0.008 250);   /* inset wells, code, form fields*/
  --ds-veil:          oklch(99% 0.004 250 / 0.72); /* frosted nav fill (over img) */

  /* ── Ink ramp · charcoal, never pure black (softer, more premium) ── */
  --ds-ink:           oklch(22% 0.018 260);     /* headings / primary text       */
  --ds-ink-body:      oklch(34% 0.015 260);     /* body copy — 8.9:1 on --ds-bg  */
  --ds-ink-muted:     oklch(48% 0.014 260);     /* captions, meta — 4.7:1 on bg  */
  --ds-ink-faint:     oklch(62% 0.012 260);     /* hairline labels on white only */
  --ds-ink-invert:    oklch(99% 0.003 250);     /* text on blue / dark imagery   */

  /* ── Saudi-blue · the trust accent (governance) ── */
  --ds-blue:          oklch(48% 0.16 250);      /* primary brand blue            */
  --ds-blue-strong:   oklch(40% 0.17 252);      /* hover / pressed / deep         */
  --ds-blue-bright:   oklch(58% 0.165 248);     /* lineage lines, focus, links    */
  --ds-blue-soft:     oklch(94% 0.03 250);      /* tinted chips / hover wells     */
  --ds-blue-ghost:    oklch(48% 0.16 250 / 0.10);

  /* ── Sand / gold · rare warm highlight (Vision-2030 nod), <5% of any view ── */
  --ds-gold:          oklch(74% 0.10 78);       /* refined sand-gold (decor/btn bg)*/
  --ds-gold-deep:     oklch(52% 0.10 66);       /* gold TEXT — AA on white & gold-soft */
  --ds-gold-soft:     oklch(95% 0.035 82);      /* faint warm wash                */

  /* ── Lines ── */
  --ds-line:          oklch(22% 0.018 260 / 0.10);  /* hairline borders          */
  --ds-line-strong:   oklch(22% 0.018 260 / 0.18);
  --ds-line-grid:     oklch(48% 0.16 250 / 0.07);   /* the data-grid motif stroke */

  /* ── Feedback ── */
  --ds-ok:            oklch(58% 0.13 155);
  --ds-warn:          oklch(70% 0.13 70);
  --ds-err:           oklch(56% 0.18 25);

  /* ── Type families ────────────────────────────────────────────────────────
     Display: Fraunces — a high-contrast optical serif. Gives the cinematic,
     editorial, expensive feel that a second grotesk could never carry, and
     contrasts the body on a real axis (serif × grotesk) per type rules.
     Body:    Inter Tight — clean modern grotesk, excellent at small sizes.
     Arabic:  IBM Plex Sans Arabic — high-quality, harmonises with Inter Tight.
     Loaded in the shell <head>; families named here so utilities can use them. */
  --ds-font-display: "Fraunces", "Times New Roman", Georgia, serif;
  --ds-font-body:    "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ds-font-ar:      "IBM Plex Sans Arabic", "Inter Tight", system-ui, sans-serif;
  --ds-font-mono:    ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* ── Type scale · fluid clamp(), cinematic but capped at ~5.5rem (no shouting)─ */
  --ds-step--1: clamp(0.82rem, 0.79rem + 0.13vw, 0.9rem);     /* fine print     */
  --ds-step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.125rem);       /* body           */
  --ds-step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);      /* lede / large   */
  --ds-step-2:  clamp(1.5rem, 1.36rem + 0.7vw, 2rem);         /* h3             */
  --ds-step-3:  clamp(1.95rem, 1.7rem + 1.25vw, 2.85rem);     /* h2             */
  --ds-step-4:  clamp(2.5rem, 2.05rem + 2.25vw, 4rem);        /* h1             */
  --ds-step-5:  clamp(3rem, 2.2rem + 4vw, 5.5rem);            /* hero display   */

  --ds-leading-tight: 1.04;
  --ds-leading-snug:  1.18;
  --ds-leading-body:  1.62;
  --ds-tracking-display: -0.022em;   /* never tighter than -0.04em rule         */
  --ds-tracking-label:   0.04em;

  /* ── Spacing scale · 4px base, geometric for rhythm ── */
  --ds-space-1: 0.25rem;
  --ds-space-2: 0.5rem;
  --ds-space-3: 0.75rem;
  --ds-space-4: 1rem;
  --ds-space-5: 1.5rem;
  --ds-space-6: 2rem;
  --ds-space-7: 3rem;
  --ds-space-8: 4rem;
  --ds-space-9: 6rem;
  --ds-space-10: 8rem;
  --ds-space-11: 11rem;     /* cinematic section breathing room                 */

  /* ── Layout ── */
  --ds-measure: 68ch;            /* prose line-length cap (65–75ch rule)         */
  --ds-container: 76rem;         /* standard content max-width                   */
  --ds-container-wide: 88rem;    /* wide hero / full-bleed inner                 */
  --ds-gutter: clamp(1.25rem, 5vw, 4rem);  /* page side padding                  */

  /* ── Radius · concentric-friendly ── */
  --ds-radius-xs: 6px;
  --ds-radius-sm: 10px;
  --ds-radius-md: 16px;
  --ds-radius-lg: 24px;
  --ds-radius-xl: 32px;
  --ds-radius-pill: 999px;

  /* ── Shadows · layered, transparent, blue-tinted (sits on a blue-tinted bg) ── */
  --ds-shadow-xs: 0 1px 2px oklch(40% 0.05 260 / 0.05);
  --ds-shadow-sm: 0 1px 2px oklch(40% 0.05 260 / 0.06),
                  0 2px 6px oklch(40% 0.05 260 / 0.05);
  --ds-shadow-md: 0 2px 4px oklch(40% 0.05 260 / 0.05),
                  0 8px 24px oklch(40% 0.05 260 / 0.08);
  --ds-shadow-lg: 0 4px 8px oklch(40% 0.05 260 / 0.05),
                  0 18px 48px oklch(40% 0.06 260 / 0.10);
  --ds-shadow-blue: 0 10px 30px oklch(48% 0.16 250 / 0.22);

  /* ── Motion · ease-out exponential, no bounce ── */
  --ds-ease: cubic-bezier(0.16, 1, 0.3, 1);          /* ease-out-expo-ish        */
  --ds-ease-soft: cubic-bezier(0.33, 1, 0.68, 1);    /* ease-out-cubic           */
  --ds-dur-1: 140ms;   /* exits, presses        */
  --ds-dur-2: 240ms;   /* hovers, small enters  */
  --ds-dur-3: 480ms;   /* section reveals       */
  --ds-dur-4: 900ms;   /* cinematic moves       */

  /* ── Z-index scale · semantic, never arbitrary ── */
  --ds-z-base: 1;
  --ds-z-grid: 2;          /* the data-grid motif overlay      */
  --ds-z-content: 5;
  --ds-z-sticky: 50;
  --ds-z-nav: 100;
  --ds-z-overlay: 200;     /* mobile menu / backdrop           */
  --ds-z-popover: 300;     /* lang popup                       */
  --ds-z-toast: 400;
}

/* ───────────────────────────────────────────────────────────────────────────
   2 · RESET + BASE
─────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  scroll-behavior: smooth;            /* JS (Lenis) takes over when active       */
  -webkit-text-size-adjust: 100%;
  /* Lenis sets html.lenis; native smooth-scroll is the fallback when it's off.  */
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  font-family: var(--ds-font-body);
  font-size: var(--ds-step-0);
  line-height: var(--ds-leading-body);
  font-weight: 400;
  color: var(--ds-ink-body);
  background: var(--ds-bg);
  -webkit-font-feature-settings: "ss01", "cv05";
  font-feature-settings: "ss01", "cv05";
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Arabic / RTL: swap to the Arabic face, relax letter-spacing (Arabic dislikes
   negative tracking), and flip logical defaults. */
html[lang="ar"] body,
html[dir="rtl"] body { font-family: var(--ds-font-ar); }
html[dir="rtl"] { --ds-tracking-display: 0em; }

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
/* Subtle inset outline so image edges don't blur into the white surface.
   Neutral alpha only — never tinted with the brand palette. */
img { outline: 1px solid oklch(22% 0.018 260 / 0.07); outline-offset: -1px; }

a { color: var(--ds-blue); text-decoration: none; }
a:hover { color: var(--ds-blue-strong); }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

:where(h1, h2, h3, h4) {
  font-family: var(--ds-font-display);
  color: var(--ds-ink);
  line-height: var(--ds-leading-snug);
  letter-spacing: var(--ds-tracking-display);
  font-weight: 380;                /* Fraunces optical: light-ish, high contrast */
  text-wrap: balance;
}
html[dir="rtl"] :where(h1, h2, h3, h4) { font-family: var(--ds-font-ar); font-weight: 600; }
p { text-wrap: pretty; }

/* ── Accessibility primitives ───────────────────────────────────────────────*/
:focus-visible {
  outline: 3px solid var(--ds-blue-bright);
  outline-offset: 3px;
  border-radius: var(--ds-radius-xs);
}
.ds-skip-link {
  position: absolute;
  left: var(--ds-space-4);
  top: -100px;
  z-index: var(--ds-z-toast);
  background: var(--ds-ink);
  color: var(--ds-ink-invert);
  padding: var(--ds-space-3) var(--ds-space-5);
  border-radius: var(--ds-radius-sm);
  font-weight: 600;
  transition: top var(--ds-dur-2) var(--ds-ease);
}
.ds-skip-link:focus { top: var(--ds-space-4); color: var(--ds-ink-invert); }

.ds-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;
}

::selection { background: var(--ds-blue-soft); color: var(--ds-ink); }

/* ───────────────────────────────────────────────────────────────────────────
   3 · TYPOGRAPHY UTILITIES
─────────────────────────────────────────────────────────────────────────── */
.ds-display   { font-family: var(--ds-font-display); font-size: var(--ds-step-5); line-height: var(--ds-leading-tight); letter-spacing: var(--ds-tracking-display); font-weight: 340; color: var(--ds-ink); text-wrap: balance; }
.ds-h1        { font-size: var(--ds-step-4); }
.ds-h2        { font-size: var(--ds-step-3); }
.ds-h3        { font-family: var(--ds-font-display); font-size: var(--ds-step-2); font-weight: 400; color: var(--ds-ink); letter-spacing: -0.01em; }
.ds-lede      { font-size: var(--ds-step-1); line-height: 1.5; color: var(--ds-ink-body); max-width: var(--ds-measure); text-wrap: pretty; }
.ds-prose     { max-width: var(--ds-measure); }
.ds-prose p + p { margin-top: var(--ds-space-5); }
.ds-muted     { color: var(--ds-ink-muted); }
.ds-mono      { font-family: var(--ds-font-mono); font-size: var(--ds-step--1); letter-spacing: 0; }

/* Kicker / label — provided but use SPARINGLY (one named label as voice, not an
   eyebrow above every section — that is the AI tell). Prefer no kicker. */
.ds-label {
  font-family: var(--ds-font-body);
  font-size: var(--ds-step--1);
  font-weight: 600;
  letter-spacing: var(--ds-tracking-label);
  text-transform: uppercase;
  color: var(--ds-blue);
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-2);
}
.ds-label::before {            /* a short lineage tick, not a bullet — on-motif */
  content: "";
  width: 1.5rem; height: 1px;
  background: linear-gradient(90deg, var(--ds-gold), transparent);
}
html[dir="rtl"] .ds-label::before { background: linear-gradient(270deg, var(--ds-gold), transparent); }

/* Numbers that update (counters, stat figures) hold their width. */
.ds-tnum { font-variant-numeric: tabular-nums; }

/* ───────────────────────────────────────────────────────────────────────────
   4 · LAYOUT UTILITIES
─────────────────────────────────────────────────────────────────────────── */
.ds-container       { width: 100%; max-width: var(--ds-container); margin-inline: auto; padding-inline: var(--ds-gutter); }
.ds-container-wide  { width: 100%; max-width: var(--ds-container-wide); margin-inline: auto; padding-inline: var(--ds-gutter); }
.ds-bleed           { width: 100%; }

.ds-section         { padding-block: var(--ds-space-10); position: relative; }
.ds-section-tight   { padding-block: var(--ds-space-8); position: relative; }
.ds-section-band    { background: var(--ds-bg-2); }
.ds-section-pin     { min-height: 100vh; min-height: 100svh; display: grid; align-items: center; }

.ds-stack > * + *   { margin-top: var(--ds-space-5); }
.ds-stack-lg > * + *{ margin-top: var(--ds-space-7); }

/* Responsive auto-grid, no breakpoints needed. */
.ds-grid            { display: grid; gap: var(--ds-space-6); }
.ds-grid-auto       { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.ds-grid-2          { grid-template-columns: repeat(2, 1fr); }
.ds-grid-3          { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 60rem) { .ds-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 40rem) { .ds-grid-2, .ds-grid-3 { grid-template-columns: 1fr; } }

.ds-flex            { display: flex; gap: var(--ds-space-4); }
.ds-flex-wrap       { flex-wrap: wrap; }
.ds-flex-center     { align-items: center; }
.ds-flex-between    { justify-content: space-between; }

/* ───────────────────────────────────────────────────────────────────────────
   5 · COMPONENTS — buttons, surfaces, pills, fields
   (foundation set; page builders extend, don't fork.)
─────────────────────────────────────────────────────────────────────────── */

/* Buttons — tactile, interruptible, explicit transition props (never `all`). */
.ds-btn {
  --_bg: var(--ds-blue);
  --_fg: var(--ds-ink-invert);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-2);
  min-height: 48px;                 /* >44px hit area */
  padding: 0.85rem 1.65rem;
  border-radius: var(--ds-radius-pill);
  font-family: var(--ds-font-body);
  font-weight: 600;
  font-size: var(--ds-step-0);
  letter-spacing: -0.005em;
  color: var(--_fg);
  background: var(--_bg);
  box-shadow: var(--ds-shadow-sm);
  transition-property: transform, background-color, box-shadow, color;
  transition-duration: var(--ds-dur-2);
  transition-timing-function: var(--ds-ease);
  white-space: nowrap;
}
.ds-btn:hover  { background: var(--ds-blue-strong); color: var(--ds-ink-invert); box-shadow: var(--ds-shadow-blue); transform: translateY(-2px); }
.ds-btn:active { transform: translateY(0) scale(0.985); transition-duration: var(--ds-dur-1); }

.ds-btn-ghost {
  --_bg: transparent;
  --_fg: var(--ds-ink);
  border: 1px solid var(--ds-line-strong);
  box-shadow: none;
}
.ds-btn-ghost:hover { --_fg: var(--ds-blue-strong); background: var(--ds-surface); border-color: var(--ds-blue); color: var(--ds-blue-strong); box-shadow: var(--ds-shadow-sm); }

.ds-btn-gold { --_bg: var(--ds-gold); --_fg: var(--ds-ink); }
.ds-btn-gold:hover { --_bg: var(--ds-gold-deep); color: var(--ds-ink); box-shadow: 0 10px 30px oklch(74% 0.10 78 / 0.3); }

/* Text link with an animated lineage underline. */
.ds-link {
  color: var(--ds-blue-strong);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--ds-dur-2) var(--ds-ease), color var(--ds-dur-2) var(--ds-ease);
  padding-bottom: 1px;
}
.ds-link:hover { background-size: 100% 1.5px; }
.ds-link .ds-link-arrow { transition: transform var(--ds-dur-2) var(--ds-ease); }
.ds-link:hover .ds-link-arrow { transform: translateX(3px); }
html[dir="rtl"] .ds-link:hover .ds-link-arrow { transform: translateX(-3px) scaleX(-1); }
html[dir="rtl"] .ds-link-arrow { transform: scaleX(-1); }

/* Surface / panel — pure white on the tinted bg, hairline + soft lift. */
.ds-panel {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-6);
  box-shadow: var(--ds-shadow-sm);
}
.ds-panel-hover {
  transition-property: transform, box-shadow, border-color;
  transition-duration: var(--ds-dur-2);
  transition-timing-function: var(--ds-ease);
}
.ds-panel-hover:hover { transform: translateY(-4px); box-shadow: var(--ds-shadow-lg); border-color: var(--ds-line-strong); }

/* Pill / chip — for alignment badges (DAMA, NDMO, Vision 2030). */
.ds-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-2);
  padding: 0.4rem 0.9rem;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-blue-soft);
  color: var(--ds-blue-strong);
  border: 1px solid var(--ds-blue-ghost);
  font-size: var(--ds-step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ds-pill-gold { background: var(--ds-gold-soft); color: var(--ds-gold-deep); border-color: oklch(74% 0.10 78 / 0.25); }

/* Form fields — generous, AA placeholder contrast. */
.ds-field {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.85rem 1rem;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--ds-radius-sm);
  color: var(--ds-ink);
  transition-property: border-color, box-shadow;
  transition-duration: var(--ds-dur-2);
  transition-timing-function: var(--ds-ease);
}
.ds-field::placeholder { color: var(--ds-ink-muted); opacity: 1; }  /* AA, not faint */
.ds-field:focus-visible { outline: none; border-color: var(--ds-blue); box-shadow: 0 0 0 3px var(--ds-blue-ghost); }
.ds-label-field { display: block; font-weight: 600; color: var(--ds-ink); margin-bottom: var(--ds-space-2); font-size: var(--ds-step-0); }

/* Hairline divider that reads as a lineage line. */
.ds-rule { height: 1px; border: 0; background: linear-gradient(90deg, transparent, var(--ds-line-strong) 18%, var(--ds-line-strong) 82%, transparent); margin-block: var(--ds-space-7); }

/* ── Openable disclosure (accordion / expandable card) — wired by site.js.
   Content is OPEN by default (no-JS / no-CSS readable); site.js adds .is-ready
   which lets .is-open collapse the panel via the grid-rows 0fr↔1fr trick. ── */
.ds-disclose { border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface);
  transition: border-color var(--ds-dur-2) var(--ds-ease), box-shadow var(--ds-dur-2) var(--ds-ease); }
.ds-disclose + .ds-disclose { margin-top: var(--ds-space-4); }
.ds-disclose:hover { border-color: var(--ds-line-strong); }
.ds-disclose.is-open { border-color: oklch(48% 0.16 250 / 0.40); box-shadow: var(--ds-shadow-md); }
.ds-disclose-trigger { width: 100%; display: flex; align-items: center; gap: var(--ds-space-5);
  padding: var(--ds-space-5) var(--ds-space-6); text-align: start; cursor: pointer;
  font-family: var(--ds-font-body); color: var(--ds-ink); }
.ds-disclose-trigger:focus-visible { outline: 3px solid var(--ds-blue-bright); outline-offset: -3px; border-radius: var(--ds-radius-md); }
.ds-disclose-num { font-family: var(--ds-font-display); font-size: var(--ds-step-2); font-weight: 400;
  color: var(--ds-blue); line-height: 1; flex: none; font-variant-numeric: tabular-nums;
  transition: color var(--ds-dur-2) var(--ds-ease); }
.ds-disclose.is-open .ds-disclose-num { color: var(--ds-gold-deep); }
.ds-disclose-head { flex: 1; min-width: 0; }
.ds-disclose-title { font-family: var(--ds-font-display); font-size: var(--ds-step-2); font-weight: 400;
  color: var(--ds-ink); letter-spacing: -0.01em; line-height: 1.2; }
.ds-disclose-sub { color: var(--ds-ink-muted); font-size: var(--ds-step-0); margin-top: 4px; }
.ds-disclose-icon { flex: none; width: 1.4rem; height: 1.4rem; color: var(--ds-ink-muted);
  transition: transform var(--ds-dur-3) var(--ds-ease), color var(--ds-dur-2) var(--ds-ease); }
.ds-disclose.is-open .ds-disclose-icon { transform: rotate(180deg); color: var(--ds-blue); }
html[dir="rtl"] .ds-disclose-icon { } /* chevron is vertical; no flip needed */
.ds-disclose-panel { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--ds-dur-3) var(--ds-ease); }
.ds-disclose.is-ready:not(.is-open) .ds-disclose-panel { grid-template-rows: 0fr; }
.ds-disclose-panel > div { overflow: hidden; }
.ds-disclose-body { padding: var(--ds-space-2) var(--ds-space-6) var(--ds-space-6); color: var(--ds-ink-body); }
.ds-disclose-body > * + * { margin-top: var(--ds-space-4); }
.ds-disclose-tags { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); margin-top: var(--ds-space-4); }

/* ───────────────────────────────────────────────────────────────────────────
   6 · §MOTIF — the data-grid / lineage-lines layer
   "governance = order over chaos." Reusable, decoration-only (aria-hidden).

   Usage patterns:
   • .ds-grid-layer            — absolutely-positioned precision grid you drop
                                 INSIDE a position:relative section / over an
                                 <img>. Fades at the edges (mask), tinted blue.
   • .ds-grid-bg               — the same grid as a section background (no extra
                                 element): apply to a .ds-section.
   • <div class="ds-lineage">  — animated SVG lineage lines (nodes + connectors).
                                 The signature "order assembling over the city."
   The grid is pure CSS gradients (no image weight). The lineage is inline SVG
   the builders paste (markup in components/shell.html, animated by scroll.js).
─────────────────────────────────────────────────────────────────────────── */
.ds-grid-layer,
.ds-grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: var(--ds-z-grid);
  pointer-events: none;
  background-image:
    linear-gradient(to right,  var(--ds-line-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ds-line-grid) 1px, transparent 1px);
  background-size: var(--ds-grid-cell, 56px) var(--ds-grid-cell, 56px);
  /* Fade the grid out toward the edges so it reads as a precision overlay,
     not a tablecloth. Radial mask = order concentrated, dissolving to calm. */
  -webkit-mask-image: radial-gradient(120% 100% at 50% 38%, #000 0%, #000 42%, transparent 78%);
          mask-image: radial-gradient(120% 100% at 50% 38%, #000 0%, #000 42%, transparent 78%);
}
.ds-grid-bg { position: relative; }
.ds-grid-bg > * { position: relative; z-index: var(--ds-z-content); }

/* Finer "data" variant — denser cells + intersection dots. */
.ds-grid-layer.is-fine { --ds-grid-cell: 36px; }
.ds-grid-layer.is-fine::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--ds-blue-bright) 1.1px, transparent 1.2px);
  background-size: var(--ds-grid-cell, 36px) var(--ds-grid-cell, 36px);
  opacity: 0.22;
  -webkit-mask-image: inherit; mask-image: inherit;
}

/* The lineage SVG container — sits over imagery in the hero / tension sections.
   Stroke + node colors are tokenised; scroll.js animates --ds-lineage-draw
   (a stroke-dashoffset proxy) and node opacity on scroll. */
.ds-lineage {
  position: absolute;
  inset: 0;
  z-index: var(--ds-z-grid);
  pointer-events: none;
  overflow: visible;
}
.ds-lineage path,
.ds-lineage line { stroke: var(--ds-blue-bright); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; opacity: 0.55; }
.ds-lineage .ds-lineage-node { fill: var(--ds-blue-bright); }
.ds-lineage .ds-lineage-node-gold { fill: var(--ds-gold); }

/* Draw-on animation hook (used by scroll.js; respects reduced-motion below). */
.ds-lineage .ds-draw {
  stroke-dasharray: var(--_len, 1200);
  stroke-dashoffset: var(--_len, 1200);
  transition: stroke-dashoffset var(--ds-dur-4) var(--ds-ease);
}
.ds-lineage.is-drawn .ds-draw { stroke-dashoffset: 0; }

/* A reusable image wrapper that lays the grid motif over a photo + a luminous
   white scrim so charcoal text stays legible (the white-cinematic move). */
.ds-citylayer { position: relative; overflow: hidden; }
.ds-citylayer > img { width: 100%; height: 100%; object-fit: cover; }
.ds-citylayer::after {        /* luminous scrim — keeps the bright/airy feel    */
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, oklch(99% 0.004 250 / 0.0) 30%, oklch(99% 0.004 250 / 0.85) 100%),
    linear-gradient(to right, oklch(99% 0.004 250 / 0.55), oklch(99% 0.004 250 / 0.0) 55%);
  z-index: var(--ds-z-base);
}

/* ───────────────────────────────────────────────────────────────────────────
   7 · MOTION UTILITIES — reveal + parallax hooks
   Defaults are VISIBLE. JS adds .is-in to play the reveal; if JS never runs
   (or the tab is hidden, or a headless renderer), content still shows. This is
   the "reveal enhances an already-visible default" rule — never gate content.
─────────────────────────────────────────────────────────────────────────── */
.ds-reveal {
  /* visible by default; only the enhancement is opt-in via [data-reveal] */
}
/* Hidden start-state is gated behind html.ds-js (scroll.js sets it). Without JS
   — or if the script errors before flagging — content stays VISIBLE, honouring
   the "reveal enhances an already-visible default; never gate content" rule. */
html.ds-js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--ds-dur-3) var(--ds-ease),
    transform var(--ds-dur-3) var(--ds-ease),
    filter var(--ds-dur-3) var(--ds-ease);
  filter: blur(4px);
  will-change: opacity, transform;
}
html.ds-js [data-reveal].is-in { opacity: 1; transform: none; filter: none; }
/* Stagger children: set --ds-stagger-i on each child (scroll.js does this). */
html.ds-js [data-reveal-stagger] > * { opacity: 0; transform: translateY(14px); transition: opacity var(--ds-dur-3) var(--ds-ease), transform var(--ds-dur-3) var(--ds-ease); transition-delay: calc(var(--ds-stagger-i, 0) * 80ms); }
html.ds-js [data-reveal-stagger].is-in > * { opacity: 1; transform: none; }

/* Parallax: scroll.js writes --ds-parallax (px) to [data-parallax] elements. */
[data-parallax] { will-change: transform; transform: translate3d(0, var(--ds-parallax, 0px), 0); }

/* Scroll cue — a slow, calm pulse for the hero. */
.ds-scrollcue { display: inline-flex; flex-direction: column; align-items: center; gap: var(--ds-space-2); color: var(--ds-ink-muted); font-size: var(--ds-step--1); letter-spacing: var(--ds-tracking-label); text-transform: uppercase; }
.ds-scrollcue .ds-scrollcue-line { width: 1px; height: 48px; background: linear-gradient(var(--ds-ink-muted), transparent); position: relative; overflow: hidden; }
.ds-scrollcue .ds-scrollcue-line::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 40%; background: var(--ds-blue-bright); animation: ds-cue 2.4s var(--ds-ease) infinite; }
@keyframes ds-cue { 0% { transform: translateY(-100%); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(250%); opacity: 0; } }

/* ───────────────────────────────────────────────────────────────────────────
   7.5 · SITE CHROME — fixed nav, mobile menu, language toggle, footer.
   Shared across every page (markup contract: docs/SHELL.html). Wired by site.js
   via #site-nav, #menu-toggle, #mobile-menu, [data-lang-set], [data-year].
   Frosted-white veil + dark ink so the bar stays legible over the bright Riyadh
   hero AND on plain-white inner pages — no per-page theming needed.
─────────────────────────────────────────────────────────────────────────── */
:root { --ds-nav-h: 4.5rem; }
@media (max-width: 48rem) { :root { --ds-nav-h: 3.75rem; } }

.ds-nav {
  position: fixed; inset-inline: 0; top: 0; z-index: var(--ds-z-nav);
  height: var(--ds-nav-h); display: flex; align-items: center;
  background: transparent; border-bottom: 1px solid transparent;
  transition: background var(--ds-dur-3) var(--ds-ease),
              box-shadow var(--ds-dur-3) var(--ds-ease),
              transform var(--ds-dur-2) var(--ds-ease),
              border-color var(--ds-dur-3) var(--ds-ease);
}
.ds-nav.is-scrolled {
  background: var(--ds-veil);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-bottom-color: var(--ds-line); box-shadow: var(--ds-shadow-sm);
}
.ds-nav.is-hidden { transform: translateY(-100%); }
.ds-nav-inner {
  width: 100%; max-width: var(--ds-container-wide); margin-inline: auto;
  padding-inline: var(--ds-gutter); display: flex; align-items: center; gap: var(--ds-space-6);
}

.ds-brand {
  display: inline-flex; align-items: center; gap: var(--ds-space-3); white-space: nowrap;
  font-family: var(--ds-font-display); font-weight: 400; font-size: var(--ds-step-1);
  letter-spacing: -0.01em; color: var(--ds-ink); line-height: 1;
}
.ds-brand:hover { color: var(--ds-ink); }
.ds-brand-mark { width: 1.7rem; height: 1.7rem; flex: none; color: var(--ds-blue); }
.ds-brand .ds-brand-d { color: var(--ds-blue); }
/* Logo IMG variant (canonical shell uses <img class="ds-logo"> with the brand PNG).
   Size by HEIGHT so the wide wordmark scales; width auto; no inset img-outline. */
.ds-logo { height: 32px; width: auto; outline: none; }
@media (max-width: 40rem) { .ds-logo { height: 27px; } }

.ds-nav-links { display: flex; align-items: center; gap: var(--ds-space-6); margin-inline-start: auto; }
.ds-nav-link {
  position: relative; font-family: var(--ds-font-body); font-size: var(--ds-step-0); font-weight: 500;
  color: var(--ds-ink-body); padding-block: var(--ds-space-2);
  transition: color var(--ds-dur-2) var(--ds-ease);
}
.ds-nav-link:hover { color: var(--ds-ink); }
.ds-nav-link::after {
  content: ""; position: absolute; inset-inline: 0 100%; bottom: 0; height: 1.5px;
  background: var(--ds-blue); transition: inset-inline-end var(--ds-dur-2) var(--ds-ease);
}
.ds-nav-link:hover::after,
.ds-nav-link[aria-current="page"]::after { inset-inline-end: 0; }
.ds-nav-link[aria-current="page"] { color: var(--ds-ink); }

.ds-nav-actions { display: flex; align-items: center; gap: var(--ds-space-4); }
.ds-lang {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-pill); background: var(--ds-surface);
}
.ds-lang button {
  font-size: var(--ds-step--1); font-weight: 600; letter-spacing: var(--ds-tracking-label);
  padding: 0.3rem 0.7rem; border-radius: var(--ds-radius-pill); color: var(--ds-ink-muted); line-height: 1;
  transition: background var(--ds-dur-2) var(--ds-ease), color var(--ds-dur-2) var(--ds-ease);
}
.ds-lang button.is-active, .ds-lang button[aria-pressed="true"] { background: var(--ds-blue); color: var(--ds-ink-invert); }

.ds-menu-toggle { display: none; width: 2.75rem; height: 2.75rem; align-items: center; justify-content: center; color: var(--ds-ink); border-radius: var(--ds-radius-sm); }
.ds-menu-toggle svg { width: 1.5rem; height: 1.5rem; }

.ds-mobile-menu {
  position: fixed; inset: 0; z-index: var(--ds-z-overlay); background: var(--ds-bg); overflow-y: auto;
  padding: calc(var(--ds-nav-h) + var(--ds-space-5)) var(--ds-gutter) var(--ds-space-7);
  display: flex; flex-direction: column; gap: var(--ds-space-1);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-8px);
  transition: opacity var(--ds-dur-3) var(--ds-ease), transform var(--ds-dur-3) var(--ds-ease), visibility var(--ds-dur-3);
}
.ds-mobile-menu.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
.ds-mobile-menu a:not(.ds-btn) {
  font-family: var(--ds-font-display); font-size: var(--ds-step-2); font-weight: 400; color: var(--ds-ink);
  padding-block: var(--ds-space-3); border-bottom: 1px solid var(--ds-line);
}
.ds-mobile-menu a[aria-current="page"]:not(.ds-btn) { color: var(--ds-blue); }
/* The menu CTA is a real button — keep its own (white-on-blue) treatment. */
.ds-mobile-actions .ds-btn { color: var(--_fg); }
.ds-mobile-actions { margin-top: var(--ds-space-6); display: flex; flex-direction: column; gap: var(--ds-space-4); }

@media (max-width: 64rem) {
  .ds-nav-links { display: none; }
  .ds-nav-actions .ds-nav-cta { display: none; }
  .ds-menu-toggle { display: inline-flex; margin-inline-start: auto; }
}
@media (min-width: 64.01rem) { .ds-mobile-menu { display: none; } }

/* Inner pages clear the fixed nav; the homepage hero is full-bleed UNDER it. */
.ds-page-head { padding-top: calc(var(--ds-nav-h) + var(--ds-space-9)); }

.ds-footer { background: var(--ds-ink); color: var(--ds-ink-invert); padding-block: var(--ds-space-9) var(--ds-space-6); margin-top: var(--ds-space-10); }
.ds-footer a { color: oklch(80% 0.02 250); transition: color var(--ds-dur-2) var(--ds-ease); }
.ds-footer a:hover { color: var(--ds-ink-invert); }
.ds-footer-top { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: var(--ds-space-7); }
@media (max-width: 60rem) { .ds-footer-top { grid-template-columns: 1fr 1fr; } }
@media (max-width: 40rem) { .ds-footer-top { grid-template-columns: 1fr; } }
.ds-footer .ds-brand { color: var(--ds-ink-invert); }
.ds-footer .ds-brand .ds-brand-d, .ds-footer .ds-brand-mark { color: var(--ds-blue-bright); }
/* The brand PNG is dark text on transparent → invert to white on the dark footer. */
.ds-logo-invert { filter: brightness(0) invert(1); height: 38px; }
.ds-footer-blurb { color: oklch(78% 0.015 250); max-width: 36ch; margin-top: var(--ds-space-4); }
.ds-footer-col h3 { font-family: var(--ds-font-body); font-weight: 600; font-size: var(--ds-step--1); letter-spacing: var(--ds-tracking-label); text-transform: uppercase; color: oklch(72% 0.02 250); margin-bottom: var(--ds-space-4); }
.ds-footer-col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--ds-space-3); }
.ds-footer-bottom { display: flex; flex-wrap: wrap; gap: var(--ds-space-4); justify-content: space-between; align-items: center; margin-top: var(--ds-space-8); padding-top: var(--ds-space-5); border-top: 1px solid oklch(100% 0 0 / 0.12); font-size: var(--ds-step--1); color: oklch(70% 0.015 250); }
.ds-footer-socials { display: flex; gap: var(--ds-space-4); }
.ds-footer-socials a { display: inline-flex; }
.ds-footer-socials svg { width: 1.25rem; height: 1.25rem; }
.ds-built { color: oklch(68% 0.015 250); }
.ds-built a { color: oklch(74% 0.02 250); border-bottom: 1px solid transparent; }
.ds-built a:hover { color: var(--ds-ink-invert); border-bottom-color: currentColor; }

/* ───────────────────────────────────────────────────────────────────────────
   8 · BREAKPOINTS reference (use min()/clamp() first; these are escape hatches)
   --  ≥ 90rem  wide / cinematic
   --  ≥ 64rem  desktop (grids settle)
   --  ≥ 48rem  tablet
   --  < 48rem  mobile (single column, no scroll-jacking)
─────────────────────────────────────────────────────────────────────────── */

/* ───────────────────────────────────────────────────────────────────────────
   9 · REDUCED MOTION — the non-negotiable fallback.
   Kill transforms/transitions, force every revealed/parallaxed element to its
   final readable state, stop the cue + lineage animation. Crossfade only.
─────────────────────────────────────────────────────────────────────────── */
@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;
    scroll-behavior: auto !important;
  }
  [data-reveal],
  [data-reveal-stagger] > * { opacity: 1 !important; transform: none !important; filter: none !important; }
  [data-parallax] { transform: none !important; }
  .ds-lineage .ds-draw { stroke-dashoffset: 0 !important; }
  .ds-scrollcue .ds-scrollcue-line::after { display: none; }
}

/* ───────────────────────────────────────────────────────────────────────────
   10 · PRINT — clean, ink-saving (Quick-Scan report sections may print)
─────────────────────────────────────────────────────────────────────────── */
@media print {
  .ds-grid-layer, .ds-lineage, .ds-citylayer::after, .ds-scrollcue { display: none !important; }
  body { color: #000; background: #fff; }
  .ds-panel { box-shadow: none; border-color: #ccc; }
}

