/* =====================================================================
   Real Hub Initiatives — main.css
   Load order: tokens → reset → base → (layout.css, components.css,
   pages.css loaded separately per-page) → utilities
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------- */
:root {
  /* ---- Institutional core (from globe body) ---- */
  --rh-navy:        #1A4373;
  --rh-blue:        #225A9A;
  --rh-blue-mid:    #2D76B5;
  --rh-blue-light:  #3F98CF;
  --rh-sky:         #68B5E0;
  --rh-mist:        #C1D6EA;

  /* ---- Pillar colours ---- */
  --pillar-human:    #2D76B5;
  --pillar-human-dp: #1A4373;
  --pillar-econ:     #ECA82E;
  --pillar-econ-dp:  #CD7023;
  --pillar-climate:    #85B942;
  --pillar-climate-dp: #337F42;
  --pillar-peace:    #225A9A;
  --pillar-peace-dp: #12325A;
  /* Pillar 5 — added after the logo/Compass were finalised (see the
     Pillar Compass note in components.css), so this teal has no source
     in the original quartered-globe artwork. Chosen only for maximum
     distinctiveness from the other four hues. */
  --pillar-water:    #1CA3AE;
  --pillar-water-dp: #0B6B72;

  /* ---- Neutrals ---- */
  --rh-ink:      #0F1A2A;
  --rh-ink-soft: #48566B;
  --rh-line:     #DCE6F0;
  --rh-surface:  #F5F8FC;
  --rh-white:    #FFFFFF;

  /* ---- Type ---- */
  --font-serif: 'IBM Plex Serif', 'IBM Plex Sans Arabic', Georgia, serif;
  --font-sans:  'IBM Plex Sans', 'IBM Plex Sans Arabic', -apple-system, sans-serif;
  --font-mono:  'IBM Plex Mono', 'IBM Plex Sans Arabic', ui-monospace, monospace;
  --font-arabic:'IBM Plex Sans Arabic', 'IBM Plex Sans', sans-serif;

  --fs-display: clamp(2.6rem, 6vw, 5rem);
  --fs-h1:      clamp(2.1rem, 4.4vw, 3.5rem);
  --fs-h2:      clamp(1.65rem, 3vw, 2.5rem);
  --fs-h3:      clamp(1.2rem, 1.8vw, 1.55rem);
  --fs-body:    clamp(1rem, 1.05vw, 1.115rem);
  --fs-small:   0.9rem;
  --fs-eyebrow: 0.76rem;

  /* ---- Spacing scale ---- */
  --sp-4: 4px;   --sp-8: 8px;   --sp-12: 12px; --sp-16: 16px;
  --sp-24: 24px; --sp-32: 32px; --sp-48: 48px; --sp-64: 64px;
  --sp-96: 96px; --sp-128: 128px;

  /* ---- Layout ---- */
  --max-width: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius-quadrant: 0 0 0 28px;

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 0.22s;
  --dur-med: 0.7s;

  /* ---- Elevation ---- */
  --shadow-sm: 0 1px 2px rgba(15, 26, 42, 0.06), 0 1px 1px rgba(15, 26, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 26, 42, 0.10), 0 2px 6px rgba(15, 26, 42, 0.06);
  --shadow-lg: 0 20px 48px rgba(15, 26, 42, 0.16), 0 4px 12px rgba(15, 26, 42, 0.08);

  --accent: var(--rh-blue); /* default; remapped per-pillar via body class */
}

/* ---------------------------------------------------------------------
   2. RESET
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* Lenis (assets/js/motion.js) owns smooth scrolling via JS. Native
   `scroll-behavior: smooth` fights Lenis's own rAF-driven physics — the two
   trying to animate the same scroll position produces stutter and the
   scroll-position "stalls" that also make the header's condense-on-scroll
   state flicker. Reduced-motion users never load Lenis at all, so they get
   plain instant scrolling, which is correct for that context. */
/* The mobile off-canvas menu (.mobile-menu in layout.css) is a fixed,
   full-viewport box shifted off-screen with `transform: translateX(100%)`
   when closed. Transforms don't remove an element from normal flow, but
   several mobile browser engines still include a transformed fixed-position
   element's original (pre-transform) layout box when computing the page's
   scrollable width — so that menu, present on every page, was silently
   registering 100vw of extra horizontal scroll space just past the right
   edge. Clipping at the root is the standard, correct fix: it can't hide
   any content since nothing on this site relies on body-level horizontal
   scroll (the program carousel, data tables, and scroll-spy index all
   scroll within their own local containers, not the page itself). */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; max-width: 100vw; }
img, picture, svg { display: block; max-width: 100%; }
/* Until real photography is dropped in (see MANIFEST.md), broken-image
   glyphs would otherwise sit visibly on top of the gradient fallback. */
.hero-slide-media img, .card-media img, .page-hero-media img,
.pillar-band-media img, .split-cta-panel--media img { color: transparent; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ---------------------------------------------------------------------
   3. BASE
   --------------------------------------------------------------------- */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--rh-ink);
  background: var(--rh-surface);
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--rh-navy);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p, li { max-width: 68ch; line-height: 1.7; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  display: block;
}

a[href] { transition: color var(--dur-fast) var(--ease-out); }

/* Arabic script rules — never apply Latin tracking to Arabic glyphs */
.is-arabic,
[lang="ar"] {
  font-family: var(--font-arabic);
  line-height: 1.9;
  letter-spacing: 0;
}

/* ---------------------------------------------------------------------
   4. ACCESSIBILITY BASICS
   --------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  inset-inline-start: var(--sp-16);
  top: -100px;
  background: var(--rh-navy);
  color: var(--rh-white);
  padding: var(--sp-12) var(--sp-24);
  border-radius: 6px;
  z-index: 1000;
  transition: top var(--dur-fast) var(--ease-out);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
}
.skip-link:focus {
  top: var(--sp-16);
}

:focus-visible {
  outline: 3px solid var(--rh-navy);
  outline-offset: 2px;
  border-radius: 2px;
}

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

/* ---------------------------------------------------------------------
   5. UTILITIES
   --------------------------------------------------------------------- */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--sp-96); position: relative; }
.section--tight { padding-block: var(--sp-64); }
.section--dark {
  background: linear-gradient(155deg, var(--rh-navy) 0%, #163a63 100%);
  color: var(--rh-white);
}
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--rh-white); }
.section--surface {
  background:
    radial-gradient(ellipse 900px 500px at 15% 0%, rgba(34, 90, 154, 0.05), transparent 60%),
    var(--rh-surface);
}
.section--white { background: var(--rh-white); }

.measure { max-width: 68ch; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--fs-small);
  padding: var(--sp-12) var(--sp-24);
  border-radius: 6px;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  min-height: 44px;
}
.btn--primary {
  background: var(--rh-blue);
  color: var(--rh-white);
  box-shadow: 0 2px 8px rgba(34, 90, 154, 0.28);
}
.btn--primary:hover { background: var(--rh-navy); box-shadow: 0 8px 20px rgba(26, 67, 115, 0.32); transform: translateY(-2px); }
.btn--ghost {
  border: 1.5px solid currentColor;
  color: var(--rh-white);
}
.btn--ghost:hover { background: rgba(255,255,255,0.1); }
.btn--outline-navy {
  border: 1.5px solid var(--rh-navy);
  color: var(--rh-navy);
}
.btn--outline-navy:hover { background: var(--rh-navy); color: var(--rh-white); box-shadow: 0 6px 16px rgba(26, 67, 115, 0.22); transform: translateY(-2px); }

.link-wipe {
  position: relative;
  display: inline-block;
}
.link-wipe::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: inset-inline-start;
  transition: transform var(--dur-fast) var(--ease-out);
}
.link-wipe:hover::after { transform: scaleX(1); }

.reveal, .reveal-group > * { opacity: 0; }
.reveal.is-revealed, .reveal-group.is-revealed > * { opacity: 1; }
.no-js .reveal, .no-js .reveal-group > * { opacity: 1; }

.pillar--human   { --accent: var(--pillar-human); }
.pillar--econ    { --accent: var(--pillar-econ-dp); }
.pillar--climate { --accent: var(--pillar-climate-dp); }
.pillar--peace   { --accent: var(--pillar-peace); }
.pillar--water   { --accent: var(--pillar-water-dp); }

/* ---------------------------------------------------------------------
   6. REDUCED MOTION
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}
