/* ===================================================================
   Elivation — Base layer (v2 — modern refresh)
   Design tokens, reset, typography, layout primitives
   Mobile-first, glassmorphism-ready, refined palette
   =================================================================== */

:root {
  /* -------- Brand palette -------- */
  --navy-950: #04091A;
  --navy-900: #06122B;
  --navy-800: #0A1F44;
  --navy-700: #122F5C;
  --navy-600: #1B3A6B;
  --navy-500: #2A4E85;
  --navy-100: #DEE6F1;
  --navy-50:  #EEF2F8;

  --gold-900: #6B4F1F;
  --gold-800: #7E5E26;
  --gold-700: #8C6E2F;
  --gold-600: #B08F44;
  --gold-500: #C9A961;
  --gold-400: #D9BD83;
  --gold-300: #E5CFA1;
  --gold-200: #EFDFBF;
  --gold-100: #F5EBD3;
  --gold-50:  #FBF7EC;

  --cream-50:  #FBF9F4;
  --cream-100: #F8F5EF;
  --cream-200: #F1ECDF;
  --cream-300: #E5DDC8;

  --ink-950: #060810;
  --ink-900: #0F1216;
  --ink-800: #1A1F26;
  --ink-700: #1F2937;
  --ink-600: #374151;
  --ink-500: #4B5563;
  --ink-400: #6B7280;
  --ink-300: #9CA3AF;
  --ink-200: #D1D5DB;
  --ink-100: #E5E7EB;
  --ink-50:  #F3F4F6;

  --success: #128A5B;
  --success-soft: #DDF2E6;
  --danger:  #B23A48;
  --danger-soft: #F8DDE0;
  --warning: #B97A1F;
  --warning-soft: #FBE9CC;
  --info:    #2A5DAB;
  --info-soft: #DDE7F7;

  /* -------- Surfaces & glass -------- */
  --bg: var(--cream-100);
  --bg-tint: #F4EFE3;
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-dark: rgba(10, 31, 68, 0.55);
  --border: #EAE3D0;
  --border-soft: #F2EBD9;
  --border-strong: #D1C7AA;

  /* -------- Type -------- */
  --font-serif: "Fraunces", "Playfair Display", "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

  /* Display scale — dramatic, mobile-first */
  --t-h1: clamp(2.4rem, 8vw, 5.4rem);
  --t-h2: clamp(2rem, 6vw, 3.6rem);
  --t-h3: clamp(1.5rem, 4vw, 2.2rem);
  --t-h4: clamp(1.2rem, 2.5vw, 1.45rem);
  --t-h5: clamp(1.05rem, 2vw, 1.2rem);
  --t-body: 1rem;
  --t-lede: clamp(1.05rem, 2vw, 1.2rem);
  --t-small: 0.875rem;
  --t-xs: 0.78rem;

  /* -------- Spacing scale -------- */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* Section padding — mobile-first */
  --section-py: clamp(56px, 10vw, 120px);
  --section-py-tight: clamp(40px, 7vw, 80px);

  /* -------- Radii -------- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-3xl: 36px;
  --radius-full: 999px;

  /* -------- Shadows — layered & nuanced -------- */
  --shadow-xs: 0 1px 2px rgba(10, 31, 68, 0.04), 0 1px 1px rgba(10, 31, 68, 0.03);
  --shadow-sm: 0 1px 3px rgba(10, 31, 68, 0.04), 0 4px 8px -2px rgba(10, 31, 68, 0.06);
  --shadow-md: 0 4px 10px -2px rgba(10, 31, 68, 0.06), 0 12px 28px -6px rgba(10, 31, 68, 0.10);
  --shadow-lg: 0 10px 24px -8px rgba(10, 31, 68, 0.10), 0 24px 56px -16px rgba(10, 31, 68, 0.16);
  --shadow-xl: 0 20px 48px -16px rgba(10, 31, 68, 0.16), 0 40px 80px -24px rgba(10, 31, 68, 0.20);
  --shadow-2xl: 0 32px 80px -24px rgba(10, 31, 68, 0.22), 0 60px 120px -30px rgba(10, 31, 68, 0.28);
  --shadow-gold: 0 8px 24px -4px rgba(201, 169, 97, 0.36), 0 16px 40px -8px rgba(201, 169, 97, 0.20);
  --shadow-glow-gold: 0 0 0 1px rgba(201, 169, 97, 0.4), 0 0 32px rgba(201, 169, 97, 0.18);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(10, 31, 68, 0.04);

  /* -------- Easing & transitions -------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 160ms var(--ease-out);
  --t-base: 280ms var(--ease-out);
  --t-slow: 460ms var(--ease-out);

  /* -------- Containers -------- */
  --container-max: 1280px;
  --container-narrow: 880px;
  --container-px: clamp(20px, 5vw, 56px);

  /* -------- Z layers -------- */
  --z-base: 1;
  --z-sticky: 50;
  --z-nav: 100;
  --z-mobile-bar: 110;
  --z-overlay: 800;
  --z-modal: 900;
  --z-toast: 1000;

  /* -------- Backdrop blur -------- */
  --blur-sm: 8px;
  --blur-md: 14px;
  --blur-lg: 22px;
  --blur-xl: 30px;
}

/* =================================================================
   Reset & base
   ================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  text-wrap: pretty;
}
img, video, svg, picture { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-700); text-decoration: none; transition: color var(--t-fast); -webkit-tap-highlight-color: transparent; }
a:hover { color: var(--gold-700); }
ul, ol { list-style: none; padding: 0; margin: 0; }
hr { border: none; border-top: 1px solid var(--border); margin: var(--space-10) 0; }

/* Mobile: prevent text size adjust */
input, select, textarea, button { -webkit-tap-highlight-color: transparent; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* =================================================================
   Typography
   ================================================================= */
h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 var(--space-4);
  color: var(--navy-900);
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); letter-spacing: -0.03em; line-height: 1.02; }
h2 { font-size: var(--t-h2); letter-spacing: -0.025em; line-height: 1.05; }
h3 { font-size: var(--t-h3); line-height: 1.15; }
h4 { font-size: var(--t-h4); font-weight: 500; line-height: 1.3; }
h5 { font-size: var(--t-h5); font-weight: 500; line-height: 1.4; }
p { margin: 0 0 var(--space-4); }

.eyebrow {
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-700);
  margin-bottom: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--gold-600);
}

.lede {
  font-size: var(--t-lede);
  color: var(--ink-500);
  max-width: 60ch;
  line-height: 1.55;
  text-wrap: pretty;
}
.muted { color: var(--ink-400); }
.text-sm { font-size: var(--t-small); }
.text-xs { font-size: var(--t-xs); }
.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: -0.01em; }

/* Numeric-tabular helper */
.num { font-variant-numeric: tabular-nums; }

/* =================================================================
   Layout primitives
   ================================================================= */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-px);
  padding-right: var(--container-px);
}
.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding-left: var(--container-px);
  padding-right: var(--container-px);
}
.container-wide {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding-left: var(--container-px);
  padding-right: var(--container-px);
}

.section { padding: var(--section-py) 0; position: relative; }
.section-tight { padding: var(--section-py-tight) 0; position: relative; }

.grid { display: grid; gap: var(--space-6); max-width: 100%; }
/* minmax(0, 1fr) prevents tracks from growing beyond their share — critical
   for preventing big serif numbers from pushing layout past viewport. */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

/* Grid children default to min-width:auto which prevents shrinking below
   content size. Force min-width:0 + max-width:100% on every grid/flex child
   site-wide to make overflow physically impossible. */
.grid > *,
.bento > *,
.calc-tool-grid > *,
.feature-grid > *,
.metric-grid > *,
.compare-pool > *,
.calc-asset-grid > *,
.opportunities-grid > *,
.resource-grid > *,
.pipeline > *,
.country-list > *,
.steps > *,
.tools-list > *,
.tools-grid > *,
.tier-ladder > * { min-width: 0; max-width: 100%; }

/* Big serif text — break long words and prevent overflow */
h1, h2, h3, h4, h5, .metric-value, .metric-card .value,
.big-num, .big-price {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Bento — for asymmetric card layouts */
.bento {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(12, 1fr);
}
.bento > * { grid-column: span 12; }
@media (min-width: 700px) {
  .bento > .b-6 { grid-column: span 6; }
  .bento > .b-4 { grid-column: span 4; }
  .bento > .b-8 { grid-column: span 8; }
  .bento > .b-3 { grid-column: span 3; }
}

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.spacer { flex: 1; }

/* =================================================================
   Utilities
   ================================================================= */
.hidden { display: none !important; }
.show-mobile { display: none; }
.show-desktop { display: revert; }
@media (max-width: 880px) {
  .show-mobile { display: revert; }
  .hide-mobile { display: none !important; }
}
@media (max-width: 640px) {
  .hide-small { display: none !important; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.no-wrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Selection */
::selection { background: var(--gold-300); color: var(--navy-900); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* =================================================================
   Animations — scroll-triggered fade-ins
   ================================================================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 80ms; }
.reveal-delay-2 { transition-delay: 160ms; }
.reveal-delay-3 { transition-delay: 240ms; }
.reveal-delay-4 { transition-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Subtle floating animation for hero accents */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.float { animation: float 6s ease-in-out infinite; }

/* Shimmer for placeholder backgrounds */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, var(--cream-100) 0%, var(--cream-200) 50%, var(--cream-100) 100%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* =================================================================
   Mobile-first body padding for fixed bottom bar
   ================================================================= */
@media (max-width: 880px) {
  body.has-mobile-bar { padding-bottom: 72px; }
}

/* =================================================================
   Decorative background helpers
   ================================================================= */
.bg-gradient-warm {
  background:
    radial-gradient(1400px 700px at 90% -10%, rgba(201,169,97,0.18), transparent 60%),
    radial-gradient(1200px 600px at -10% 110%, rgba(27,58,107,0.16), transparent 60%),
    var(--cream-50);
}
.bg-gradient-dark {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(201,169,97,0.22), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(27,58,107,0.20), transparent 60%),
    linear-gradient(135deg, var(--navy-950) 0%, var(--navy-900) 55%, var(--navy-800) 100%);
}
.bg-noise::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}
