/* ============================================================
   TradeLogic Capital — Base design system
   ============================================================ */
:root {
  --cream: #F4EFE6;
  --cream-alt: #EBE3D3;
  --surface: #FBF8F1;
  --ink: #1F1A12;
  --ink-muted: #5B5346;
  --ink-faint: #9C9384;
  --walnut: #3A2A18;
  --walnut-soft: #6D5236;
  --walnut-hover: #2A1E11;
  --amber: #B5701F;
  --border: #D9CFBB;
  --olive: #4E6B3A;
  --terracotta: #8A3A2A;
  --dark-bg: #171310;
  --espresso: #1A140C;
  --portal-bg: #EDE6D5;

  --font-display: "Sentient", Georgia, serif;
  --font-body: "General Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.85rem;
  --text-base: 1rem;
  --text-lg: 1.2rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.95rem;
  --text-3xl: 2.6rem;
  --text-hero: clamp(2.5rem, 5.5vw, 4.8rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(31,26,18,0.04), 0 2px 8px rgba(31,26,18,0.05);
  --shadow-md: 0 4px 14px rgba(31,26,18,0.07), 0 12px 34px rgba(31,26,18,0.07);
  --shadow-lg: 0 10px 40px rgba(31,26,18,0.12);
  --maxw: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  font-size: 16px;
}
h1,h2,h3,h4 { font-family: var(--font-display); font-optical-sizing: auto; font-weight: 400; margin: 0; line-height: 1.12; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }
a { color: var(--walnut); text-decoration: none; transition: color 0.25s var(--ease); }
img, video, svg { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums lining-nums; }
.tnum { font-variant-numeric: tabular-nums lining-nums; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }
.wrap-narrow { max-width: 940px; margin: 0 auto; padding: 0 32px; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--amber);
  margin: 0 0 18px;
}
.pos { color: var(--olive); }
.neg { color: var(--terracotta); }

/* ---------- Public sticky header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 72px;
  background: rgba(244, 239, 230, 0.94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cream-alt);
  display: flex; align-items: center;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand .mark { width: 30px; height: 30px; color: var(--walnut); flex: none; }
.brand .wordmark { display: flex; align-items: baseline; gap: 6px; }
.brand .wm-1 { font-family: var(--font-display); font-size: 1.22rem; font-weight: 400; color: var(--ink); letter-spacing: -0.01em; }
.brand .wm-2 { font-family: var(--font-body); font-size: 0.72rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.2em; color: var(--ink-muted); }
.nav-center { display: flex; gap: 34px; }
.nav-drawer-only { display: none; }
.nav-center a { font-size: 0.82rem; letter-spacing: 0.04em; color: var(--ink-muted); }
.nav-center a:hover, .nav-center a.active { color: var(--walnut); }
.nav-right { display: flex; align-items: center; gap: 18px; }
.lang-chip { position: relative; font-size: 0.75rem; letter-spacing: 0.1em; color: var(--ink-muted); border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px; cursor: default; }
.lang-chip .tip { position: absolute; top: 130%; right: 0; background: var(--ink); color: var(--cream); font-size: 0.66rem; padding: 6px 10px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.25s; letter-spacing: 0.02em; }
.lang-chip:hover .tip { opacity: 1; }
.btn-pill {
  background: var(--walnut); color: var(--cream);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  border-radius: 22px; padding: 9px 20px;
  font-size: 0.82rem; font-weight: 500; letter-spacing: 0.02em;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn-pill:hover { background: var(--walnut-hover); transform: translateY(-1px); }

/* mobile nav */
.nav-toggle { display: none; background: none; border: none; color: var(--ink); padding: 6px; }
.nav-toggle svg { width: 24px; height: 24px; }
@media (max-width: 900px) {
  .nav-center { position: fixed; top: 72px; left: 0; right: 0; z-index: 99; background: var(--cream); flex-direction: column; gap: 0; padding: 8px 0; border-bottom: 1px solid var(--cream-alt); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: 0.3s var(--ease); box-shadow: var(--shadow-md); }
  .nav-center.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-center a { padding: 14px 32px; font-size: 0.95rem; }
  .nav-drawer-only { display: block; }
  .nav-drawer-login { color: var(--walnut); font-weight: 600; border-top: 1px solid var(--cream-alt); margin-top: 4px; }
  .nav-toggle { display: block; order: 3; }
  .nav-right .lang-chip { display: none; }
  .nav-right .btn-pill { display: none; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 26px; padding: 13px 26px; font-size: 0.9rem; font-weight: 500; letter-spacing: 0.01em; border: 1px solid transparent; transition: all 0.28s var(--ease); }
.btn-primary { background: var(--walnut); color: var(--cream); }
.btn-primary:hover { background: var(--walnut-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-cream { background: var(--cream); color: var(--walnut); }
.btn-cream:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: rgba(244,239,230,0.06); border: 1px solid rgba(244,239,230,0.4); color: var(--cream); backdrop-filter: blur(6px); }
.btn-ghost:hover { background: rgba(244,239,230,0.14); transform: translateY(-2px); }
.btn-outline { background: transparent; border: 1px solid var(--walnut); color: var(--walnut); }
.btn-outline:hover { background: var(--walnut); color: var(--cream); }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 500; color: var(--walnut); }
.link-arrow:hover { gap: 10px; }

/* ---------- Sections ---------- */
section { position: relative; }
.pad { padding: 110px 0; }
.pad-sm { padding: 72px 0; }
.bg-alt { background: var(--cream-alt); }
.bg-surface { background: var(--surface); }
.divider { height: 1px; background: var(--border); border: none; margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow-sm); }
.card-lift { transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.card-lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Footer ---------- */
.site-footer { background: var(--espresso); color: var(--cream); padding: 68px 0 34px; }
.site-footer .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.site-footer h4 { font-family: var(--font-body); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--amber); margin: 0 0 16px; font-weight: 500; }
.site-footer a { color: rgba(244,239,230,0.72); font-size: 0.86rem; display: block; margin-bottom: 10px; }
.site-footer a:hover { color: var(--cream); }
.site-footer .fbrand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--cream); }
.site-footer .fbrand .mark { width: 28px; height: 28px; color: var(--cream); }
.site-footer .fdesc { color: rgba(244,239,230,0.66); font-size: 0.86rem; max-width: 30ch; }
.footer-bottom { border-top: 1px solid rgba(244,239,230,0.12); margin-top: 48px; padding-top: 26px; }
.footer-bottom .copy { font-size: 0.8rem; color: rgba(244,239,230,0.8); margin-bottom: 12px; }
.footer-bottom .risk { font-size: 0.72rem; color: rgba(244,239,230,0.5); line-height: 1.7; max-width: 100ch; margin-bottom: 12px; }
.footer-bottom .credit { font-size: 0.68rem; color: rgba(244,239,230,0.4); }
@media (max-width: 820px) {
  .site-footer .cols { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 500px) { .site-footer .cols { grid-template-columns: 1fr; } }

/* ---------- Charts: prevent transient canvas overflow ---------- */
canvas { max-width: 100%; }
/* Grid children must be allowed to shrink below intrinsic content (e.g. a
   600px-attr Chart.js canvas) or they force horizontal page overflow. */
.grid > *, .kpi-row > *, .pgrid > *, .slider-grid > *, .g-2 > *, .g-3 > *, .g-4 > * { min-width: 0; }

/* ---------- Utilities ---------- */
.grid { display: grid; gap: 26px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g-3, .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } .pad { padding: 72px 0; } .wrap, .wrap-narrow { padding: 0 22px; } }

.disclosure { font-size: 0.74rem; color: var(--ink-faint); line-height: 1.6; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
