/* ==========================================================================
   Clovantis — base.css
   Design tokens, reset, typography, layout primitives, utilities
   ========================================================================== */

/* ---------- 1. Design tokens ---------------------------------------------- */
:root {
  /* Brand — derived from the Clovantis mark (deep navy + azure) */
  --navy-990: #04091A;
  --navy-950: #060E20;
  --navy-900: #0A1428;
  --navy-850: #0D1B33;
  --navy-800: #122343;
  --navy-700: #1B3158;
  --navy-600: #27456F;

  --azure-300: #8CC3FF;
  --azure-400: #4DA3FF;
  --azure-500: #2D7FF9;
  --azure-600: #1B5FD9;

  /* Africa side of the corridor — warm sand */
  --sand-200: #F2DCB3;
  --sand-300: #E9C98A;
  --sand-400: #D4A857;
  --sand-500: #B0873C;

  --paper-50: #FBFAF8;
  --paper-100: #F5F3EF;
  --paper-200: #EAE7E0;
  --paper-300: #D9D5CB;

  /* Semantic — dark theme is the default */
  --bg:            var(--navy-990);
  --bg-raised:     #080F22;
  --bg-elevated:   #0B1730;
  --surface:       rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --hairline:      rgba(255, 255, 255, 0.10);
  --hairline-soft: rgba(255, 255, 255, 0.06);
  --hairline-loud: rgba(255, 255, 255, 0.18);

  --text:          #F2F5FA;
  --text-soft:     #B9C4D8;
  --text-muted:    #7D8CA8;
  --text-faint:    #566278;

  --accent:        var(--azure-400);
  --accent-strong: var(--azure-500);
  --accent-soft:   rgba(77, 163, 255, 0.14);
  --accent-2:      var(--sand-300);
  --accent-2-soft: rgba(233, 201, 138, 0.14);

  --focus-ring: var(--azure-300);

  /* Typography */
  --font-display: "Instrument Serif", "IBM Plex Sans Arabic", Georgia, "Times New Roman", serif;
  --font-sans: "Inter Tight", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --step--2: clamp(0.70rem, 0.68rem + 0.10vw, 0.76rem);
  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.90rem);
  --step-0:  clamp(0.98rem, 0.94rem + 0.20vw, 1.09rem);
  --step-1:  clamp(1.15rem, 1.08rem + 0.36vw, 1.40rem);
  --step-2:  clamp(1.40rem, 1.26rem + 0.70vw, 1.90rem);
  --step-3:  clamp(1.75rem, 1.48rem + 1.35vw, 2.70rem);
  --step-4:  clamp(2.15rem, 1.65rem + 2.50vw, 3.80rem);
  --step-5:  clamp(2.60rem, 1.70rem + 4.50vw, 5.60rem);
  --step-6:  clamp(3.10rem, 1.50rem + 8.00vw, 8.00rem);

  /* Space */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4rem;
  --sp-9: 6rem;    --sp-10: 8rem;   --sp-11: 11rem;

  --section-y: clamp(4.5rem, 3rem + 7vw, 9.5rem);
  --gutter: clamp(1.15rem, 0.6rem + 2.6vw, 3rem);
  --measure: 68ch;
  --container: 1240px;
  --container-wide: 1460px;

  /* Shape & depth */
  --r-xs: 4px; --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-xl: 32px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30), 0 4px 14px -6px rgba(0,0,0,.40);
  --shadow-md: 0 2px 6px rgba(0,0,0,.28), 0 18px 40px -18px rgba(0,0,0,.65);
  --shadow-lg: 0 4px 10px rgba(0,0,0,.30), 0 40px 90px -30px rgba(0,0,0,.80);
  --glow: 0 0 0 1px rgba(77,163,255,.22), 0 18px 60px -22px rgba(45,127,249,.55);

  /* Motion */
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-in-out: cubic-bezier(.65,.05,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --t-fast: 160ms; --t-base: 280ms; --t-slow: 560ms; --t-xslow: 1000ms;

  color-scheme: dark;
}

/* ---------- 2. Light theme ------------------------------------------------ */
:root[data-theme="light"] {
  --bg:            var(--paper-50);
  --bg-raised:     #FFFFFF;
  --bg-elevated:   #FFFFFF;
  --surface:       rgba(10, 20, 40, 0.028);
  --surface-hover: rgba(10, 20, 40, 0.055);
  --hairline:      rgba(10, 20, 40, 0.12);
  --hairline-soft: rgba(10, 20, 40, 0.07);
  --hairline-loud: rgba(10, 20, 40, 0.22);

  --text:       #0A1428;
  --text-soft:  #3C4A63;
  --text-muted: #65728B;
  --text-faint: #8D97AB;

  --accent:        var(--azure-600);
  --accent-strong: var(--azure-500);
  --accent-soft:   rgba(27, 95, 217, 0.10);
  --accent-2:      var(--sand-500);
  --accent-2-soft: rgba(176, 135, 60, 0.12);

  --focus-ring: var(--azure-600);

  --shadow-sm: 0 1px 2px rgba(10,20,40,.06), 0 4px 14px -6px rgba(10,20,40,.10);
  --shadow-md: 0 2px 6px rgba(10,20,40,.06), 0 18px 40px -18px rgba(10,20,40,.18);
  --shadow-lg: 0 4px 10px rgba(10,20,40,.07), 0 40px 90px -30px rgba(10,20,40,.22);
  --glow: 0 0 0 1px rgba(27,95,217,.16), 0 18px 60px -22px rgba(27,95,217,.26);

  color-scheme: light;
}

/* ---------- 3. Reset ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
  /* clip, not hidden: hidden would make the root a scroll container and
     break the sticky column in the Path section. */
  overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  min-height: 100svh;
  transition: background-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}

img, svg, video, canvas, picture { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--hairline); }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}
::selection { background: var(--accent-strong); color: #fff; }

/* ---------- 4. Typography ------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p  { text-wrap: pretty; }

.display    { font-family: var(--font-display); font-weight: 400; line-height: 1.02; letter-spacing: -0.025em; }
.display-xl { font-size: var(--step-6); }
.display-lg { font-size: var(--step-5); }
.italic     { font-style: italic; }

.lede { font-size: var(--step-1); line-height: 1.6; color: var(--text-soft); max-width: var(--measure); font-weight: 350; }
.body-lg { font-size: var(--step-1); line-height: 1.65; color: var(--text-soft); }
.small { font-size: var(--step--1); }
.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow::before {
  content: ""; inline-size: 2rem; block-size: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  flex: none;
}
.eyebrow--plain::before { display: none; }

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.03em;
}

.accent   { color: var(--accent); }
.accent-2 { color: var(--accent-2); }

/* Gradient text used sparingly, on key statements only */
.grad-text {
  background: linear-gradient(104deg, var(--text) 18%, var(--azure-300) 52%, var(--sand-300) 92%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
:root[data-theme="light"] .grad-text {
  background: linear-gradient(104deg, var(--navy-900) 12%, var(--azure-600) 55%, var(--sand-500) 95%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

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

.stack > * + * { margin-block-start: var(--flow, var(--sp-5)); }
.grid { display: grid; gap: var(--sp-6); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } }

.row { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { text-align: center; }
.center-x { margin-inline: auto; }

/* Section head: eyebrow + title + lede, used on every page */
.sec-head { display: grid; gap: var(--sp-4); max-width: 54rem; margin-block-end: clamp(2.5rem, 1.5rem + 3vw, 4.5rem); }
.sec-head--center { margin-inline: auto; text-align: center; justify-items: center; }
.sec-head--split {
  max-width: none;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: end; gap: clamp(1.5rem, 1rem + 3vw, 5rem);
}
@media (max-width: 860px) { .sec-head--split { grid-template-columns: minmax(0, 1fr); align-items: start; } }

/* ---------- 6. Ambient surfaces ------------------------------------------- */
/* Fine film grain — gives the dark surfaces depth instead of flat black */
.grain::after {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: 0.038; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="light"] .grain::after { opacity: 0.05; mix-blend-mode: multiply; }

/* Mesh glow blobs */
.glow-field { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.glow-field::before, .glow-field::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px);
}
.glow-field::before {
  inline-size: 46vw; block-size: 46vw; inset-block-start: -16vw; inset-inline-start: -10vw;
  background: radial-gradient(circle, rgba(45,127,249,.26), transparent 68%);
}
.glow-field::after {
  inline-size: 38vw; block-size: 38vw; inset-block-end: -14vw; inset-inline-end: -8vw;
  background: radial-gradient(circle, rgba(212,168,87,.16), transparent 68%);
}
:root[data-theme="light"] .glow-field::before { background: radial-gradient(circle, rgba(45,127,249,.14), transparent 68%); }
:root[data-theme="light"] .glow-field::after  { background: radial-gradient(circle, rgba(176,135,60,.12), transparent 68%); }

/* Hairline grid backdrop */
.grid-lines {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--hairline-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hairline-soft) 1px, transparent 1px);
  background-size: clamp(60px, 7vw, 110px) clamp(60px, 7vw, 110px);
  -webkit-mask-image: radial-gradient(ellipse 110% 78% at 50% 32%, #000 18%, transparent 78%);
          mask-image: radial-gradient(ellipse 110% 78% at 50% 32%, #000 18%, transparent 78%);
  opacity: .85;
}

/* Full-bleed hairline separator with a lit centre */
.rule {
  block-size: 1px; border: 0; margin: 0;
  background: linear-gradient(90deg, transparent, var(--hairline-loud) 22%, var(--hairline-loud) 78%, transparent);
}

/* ---------- 7. Scroll reveal ---------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition:
    opacity 760ms var(--ease-out) var(--reveal-delay, 0ms),
    transform 860ms var(--ease-out) var(--reveal-delay, 0ms),
    filter 860ms var(--ease-out) var(--reveal-delay, 0ms);
  filter: blur(6px);
  will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translate3d(-28px, 0, 0); }
[data-reveal="right"] { transform: translate3d(28px, 0, 0); }
[data-reveal="scale"] { transform: scale(.955); }
[data-reveal].is-in { opacity: 1; transform: none; filter: none; }

/* Below the two-column breakpoint the layout is single column, so a sideways
   entrance has nothing to express and only risks horizontal overflow. */
@media (max-width: 900px) {
  [data-reveal="left"], [data-reveal="right"] { transform: translate3d(0, 22px, 0); }
}

/* Per-line hero entrance */
.reveal-line { display: block; overflow: hidden; padding-block-end: 0.08em; margin-block-end: -0.08em; }
.reveal-line > span {
  display: block;
  transform: translate3d(0, 108%, 0);
  transition: transform 1100ms var(--ease-out) var(--reveal-delay, 0ms);
}
.is-loaded .reveal-line > span { transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal].is-in { opacity: 1; transform: none; filter: none; transition: none; }
  .reveal-line > span { transform: none !important; transition: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 8. Utilities -------------------------------------------------- */
.visually-hidden {
  position: absolute !important; inline-size: 1px; block-size: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.no-scroll { overflow: hidden; }
.relative { position: relative; z-index: 1; }

/* Cross-document view transitions for the multi-page navigation */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 200ms var(--ease-out) both; }
::view-transition-new(root) { animation: vt-in 380ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in  { from { opacity: 0; transform: translateY(10px); } }
