:root {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --navy: #1b4f72;
  --purple: #6d28d9;
  --emerald: #059669;
  --emerald-bg: #ecfdf5;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; font-variant-numeric: tabular-nums; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.02em;
}
.brand-mark {
  width: 12px; height: 12px; border-radius: 3px;
  background: linear-gradient(135deg, var(--navy), var(--purple));
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.14);
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-size: 0.9rem; font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--purple); }
.nav-links a.nav-ext {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  color: var(--text); background: var(--surface); font-size: 0.84rem;
}
.nav-links a.nav-ext:hover { border-color: var(--purple); color: var(--purple); }

/* Hero */
.hero {
  padding: 44px 0 30px;
  background: radial-gradient(circle at 85% 10%, rgba(109, 40, 217, 0.06), transparent 45%),
              radial-gradient(circle at 10% 20%, rgba(27, 79, 114, 0.06), transparent 45%);
}
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.live-pill, .version-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.78rem; font-weight: 600; padding: 5px 11px; border-radius: 999px;
}
.live-pill { background: var(--emerald-bg); color: var(--emerald); border: 1px solid #a7f3d0; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.22);
}
.version-pill { background: #ede9fe; color: var(--purple); border: 1px solid #ddd6fe; }

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 800; letter-spacing: -0.035em;
  line-height: 1.12; margin-bottom: 12px; color: var(--text);
}
.hero-sub {
  max-width: 740px; font-size: 1.05rem; color: var(--muted); margin-bottom: 28px;
}

/* KPI Grid */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.kpi-primary { border-top: 3px solid var(--purple); }
.kpi-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--subtle); margin-bottom: 8px; }
.kpi-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.kpi-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.kpi-foot { font-size: 0.8rem; color: var(--subtle); }

.regime-badge, .risk-badge, .neutral-badge {
  font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: 0.03em;
}
.badge-green { background: var(--emerald-bg); color: var(--emerald); border: 1px solid #a7f3d0; }
.badge-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid #fde68a; }
.badge-red { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.neutral-badge { background: #eff6ff; color: var(--navy); border: 1px solid #bfdbfe; }

/* Sections & Cards */
.section { padding: 32px 0 44px; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { margin-bottom: 22px; max-width: 780px; }
.section-head h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 6px; }
.section-head p { color: var(--muted); font-size: 0.98rem; }
.eyebrow {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--purple); margin-bottom: 6px;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.chart-card { padding: 22px 24px 18px; }
.card-header {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 12px;
}
.card-header h2, .card-header h3 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.card-sub { font-size: 0.86rem; color: var(--subtle); margin-top: 2px; }

/* Range buttons */
.range-controls { display: inline-flex; gap: 6px; background: var(--bg-alt); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.range-btn {
  border: none; background: transparent; color: var(--muted); font-family: inherit;
  font-size: 0.78rem; font-weight: 600; padding: 6px 11px; border-radius: 7px; cursor: pointer;
  transition: all 0.15s;
}
.range-btn:hover { color: var(--text); }
.range-btn.active { background: var(--surface); color: var(--purple); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.chart-box { width: 100%; }
.chart-main-box { height: 540px; }
.chart-prob-box { height: 390px; }

.chart-legend-note {
  display: flex; flex-wrap: wrap; gap: 18px; padding-top: 10px; margin-top: 6px;
  border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--subtle);
}
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.swatch-aei { background: var(--navy); }
.swatch-esi { background: var(--emerald); }
.swatch-caution { background: rgba(245, 158, 11, 0.25); border: 1px solid var(--amber); }
.swatch-nber { background: rgba(220, 38, 38, 0.2); border: 1px solid rgba(220, 38, 38, 0.4); }

/* Overview & What-is-ESI 3-col */
.what-is-wrap { margin-top: 28px; }
.three-col-explain { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
.prose-card { padding: 22px 24px; display: flex; flex-direction: column; }
.prose-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.prose-card p { color: var(--muted); font-size: 0.92rem; margin-bottom: 12px; }
.how-read-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
}
.how-read-box strong { color: var(--navy); }
.callout-stat {
  margin-top: auto; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-alt); border: 1px solid var(--border); font-size: 0.85rem; color: var(--text);
}
.accent-purple { color: var(--purple); }
.accent-navy { color: var(--navy); }

.pillar-grid-four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.pillar-desc { font-size: 0.88rem; color: var(--muted); line-height: 1.55; margin-top: 2px; }

.concept-viz {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 4px 2px;
  margin-bottom: 12px;
}
.domino-card {
  margin-top: 18px;
  padding: 18px 22px 16px;
}
.domino-svg-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 8px;
  overflow-x: auto;
}
.domino-caption {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}
.domino-caption strong { color: var(--navy); }

/* Components Pillar Bar */
.pillar-bar-wrap { padding: 24px 26px; }
.pillar-bar-title { font-size: 0.86rem; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.pillar-bar {
  display: flex; height: 38px; border-radius: 10px; overflow: hidden; margin-bottom: 22px;
  font-size: 0.82rem; font-weight: 700; color: #fff;
}
.pb-seg { display: flex; align-items: center; justify-content: center; white-space: nowrap; padding: 0 8px; }
.pb-labor { background: #1b4f72; }
.pb-housing { background: #0e7490; }
.pb-market { background: #6d28d9; }

.pillar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pillar-box { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.pillar-head {
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.92rem;
  margin-bottom: 10px; color: var(--text);
}
.flow-head { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.pillar-head .pct { margin-left: auto; color: var(--subtle); font-size: 0.84rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-labor { background: #1b4f72; }
.dot-housing { background: #0e7490; }
.dot-market { background: #6d28d9; }
.dot-flow { background: #d97706; }

.pillar-box ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pillar-box li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.85rem; color: var(--muted);
}
.pillar-box code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.74rem;
  background: var(--surface); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 6px; color: var(--text); white-space: nowrap;
}

/* Prob + Gauge Layout */
.prob-layout { display: grid; grid-template-columns: 1fr 330px; gap: 20px; align-items: stretch; }
.gauge-card { padding: 24px 22px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.gauge-card h3 { font-size: 1.15rem; font-weight: 700; }
.gauge-date { font-size: 0.84rem; color: var(--subtle); margin-top: 2px; }
.gauge-box { width: 100%; height: 245px; }
.gauge-verdict {
  font-size: 0.9rem; font-weight: 600; padding: 10px 14px; border-radius: 10px;
  margin-top: 4px; width: 100%;
}
.gauge-scale {
  display: flex; justify-content: space-between; width: 100%; margin-top: auto; padding-top: 14px;
  font-size: 0.75rem; font-weight: 600;
}
.gs-low { color: var(--emerald); }
.gs-med { color: var(--amber); }
.gs-high { color: var(--red); }

/* Methodology */
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.method-card { padding: 22px 24px; }
.method-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.method-card p { font-size: 0.9rem; color: var(--muted); }
.method-card code { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; background: var(--bg-alt); padding: 1px 5px; border-radius: 4px; }

/* Macro x Market Synthesis Banner */
.synthesis-banner {
  margin-top: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple);
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
  flex-wrap: wrap;
}
.synth-left { flex: 1; min-width: 280px; }
.synth-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--purple);
  margin-bottom: 4px;
}
.synth-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; }
.synth-title { font-size: 1.05rem; font-weight: 800; color: var(--text); letter-spacing: -0.015em; }
.synth-desc { font-size: 0.86rem; color: var(--muted); max-width: 760px; margin: 0; }
.synth-watch { font-size: 0.81rem; color: var(--navy); font-weight: 600; margin: 6px 0 0; }
.stance-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--navy);
}
.stance-green   { background: #059669; }
.stance-bright  { background: #047857; box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2); }
.stance-blue    { background: #2563eb; }
.stance-amber   { background: #d97706; }
.stance-red     { background: #dc2626; }
.stance-darkred { background: #991b1b; }
.synth-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--muted);
}
.synth-right { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.synth-pill-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.synth-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
}
.synth-btn {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--navy);
  padding: 7px 13px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.synth-btn:hover { opacity: 0.9; }

/* Footer */
.site-footer { padding: 28px 0; background: var(--surface); border-top: 1px solid var(--border); font-size: 0.86rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.site-footer a { color: var(--purple); text-decoration: none; font-weight: 600; }
.footer-note { font-size: 0.8rem; color: var(--subtle); }

@media (max-width: 1024px) {
  .kpi-grid, .pillar-grid-four { grid-template-columns: repeat(2, 1fr); }
  .prob-layout { grid-template-columns: 1fr; }
  .pillar-grid, .method-grid, .three-col-explain { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .kpi-grid, .two-col, .pillar-grid-four { grid-template-columns: 1fr; }
  .chart-main-box { height: 460px; }
  .chart-prob-box { height: 320px; }
}
