/* ============================================================================
   LakshaFin — Indigo Vault Design Tokens
   Single source of truth for palette, type scale, spacing, radius, and the
   signature component patterns. Both the B2C app and the B2B/advisor screens
   pull from THIS file — do not restate colors/spacing per screen.

   Canonical copy lives at repo root. It is synced to:
     - www/design-tokens.css   (Capacitor app, referenced as ./design-tokens.css)
     - site/design-tokens.css  (Cloudflare Pages, referenced as /design-tokens.css)
   Run tools/sync-tokens.sh after editing this file.

   Fonts (add to each page <head>):
     <link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
   ========================================================================== */

:root {
  /* ---- Core palette ---- */
  --paper:        #F5F3ED;   /* app background */
  --paper-raised: #FBFAF7;   /* raised surfaces (cards on paper) */
  --ink:          #1B1B17;   /* primary text */
  --ink-muted:    #6E6B60;   /* secondary text */

  --indigo-900:   #1B2447;   /* signature dark surface (ledger/health cards) */
  --indigo-800:   #232E58;
  --indigo-700:   #2C3860;
  --indigo-500:   #4A5A8F;

  --gold:         #C4952E;   /* accent — ratings, bars, emphasis */
  --gold-soft:    #E8D6A8;

  --line:         #DAD5C7;              /* hairline on paper */
  --line-on-indigo: rgba(255,255,255,0.14);

  /* Text tokens for use ON indigo surfaces */
  --on-indigo:        #EFEDE4;
  --on-indigo-strong: #F1EFE6;
  --on-indigo-muted:  #9AA3C4;
  --on-indigo-faint:  #8D93AE;
  --on-indigo-dim:    #565F80;

  /* Status (kept minimal + on-brand) */
  --status-strong:  #3E7E5B;   /* healthy / leading */
  --status-warn:    #C4952E;   /* watch / needs review */
  --status-risk:    #B4482F;   /* lagging / at risk */

  /* ---- Semantic aliases (prefer these in components) ---- */
  --bg:           var(--paper);
  --surface:      var(--paper-raised);
  --surface-dark: var(--indigo-900);
  --text:         var(--ink);
  --text-muted:   var(--ink-muted);
  --accent:       var(--gold);
  --brand:        var(--indigo-900);
  --border:       var(--line);

  /* ---- Type ---- */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --fs-display-1: 56px;   /* hero */
  --fs-display-2: 38px;   /* app health value */
  --fs-display-3: 34px;   /* section head */
  --fs-h2:        32px;
  --fs-h3:        19px;
  --fs-lede:      17px;
  --fs-body:      15px;
  --fs-sm:        14px;
  --fs-label:     12px;   /* eyebrow / mono labels */
  --fs-mono-sm:   11px;
  --fs-mono-xs:   10px;

  --lh-tight: 1.04;
  --lh-snug:  1.3;
  --lh-body:  1.5;
  --lh-relaxed: 1.6;
  --tracking-mono: 0.1em;
  --tracking-tight: -0.015em;

  /* ---- Spacing (8-based) ---- */
  --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;

  /* ---- Radius ---- */
  --radius-sm:  12px;
  --radius:     14px;   /* default */
  --radius-md:  16px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-pill: 100px;

  /* ---- Elevation ---- */
  --shadow-card: 0 1px 2px rgba(27,27,23,0.04), 0 8px 24px rgba(27,27,23,0.05);
}

/* ============================================================================
   COMPONENT PATTERNS — reuse these class names across B2C + B2B screens.
   ========================================================================== */

/* Mono eyebrow / section label */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--indigo-700);
}

/* Signature ledger divider */
.ledger-line {
  position: relative;
  height: 1px;
  background: var(--line);
  margin: var(--space-10) 0;
}
.ledger-line::before,
.ledger-line::after {
  content: '';
  position: absolute;
  top: -3px;
  width: 1px;
  height: 7px;
  background: var(--ink-muted);
}
.ledger-line::before { left: 0; }
.ledger-line::after  { right: 0; }

/* Ledger card — indigo surface listing funds as rows (hero / detail) */
.ledger-card {
  background: var(--indigo-900);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  color: var(--on-indigo);
  position: relative;
  overflow: hidden;
}
.ledger-card::before {
  content: '';
  position: absolute; top: -40%; right: -30%; width: 70%; height: 140%;
  background: radial-gradient(circle, rgba(196,149,46,0.16), transparent 65%);
  pointer-events: none;
}
.ledger-card .label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono-sm);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--on-indigo-muted);
}
.ledger-card .score {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 500;
  margin: 10px 0 4px;
}
.ledger-card .score-tag {
  color: var(--gold-soft);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-6);
  display: block;
}

/* Row inside a ledger card */
.ledger-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line-on-indigo);
  font-size: var(--fs-sm);
}
.ledger-row:last-child { border-bottom: 1px solid var(--line-on-indigo); }
.ledger-row .fund-name { color: var(--on-indigo-strong); }
.ledger-row .fund-note { font-size: var(--fs-label); color: var(--on-indigo-faint); margin-top: 2px; }

/* Star rating (mono, gold; .dim for lagging) */
.stars {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 1px;
}
.stars.dim { color: var(--on-indigo-dim); }

/* Health card — compact indigo score block (app home) */
.health-card {
  background: var(--indigo-900);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  color: var(--on-indigo);
}
.health-card .label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-indigo-muted);
}
.health-card .value {
  font-family: var(--font-display);
  font-size: var(--fs-display-2);
  margin: 6px 0 2px;
}
.health-card .tag { font-size: var(--fs-label); color: var(--gold-soft); }
.bar-track {
  height: 3px; background: var(--line-on-indigo); border-radius: 2px;
  margin-top: var(--space-4); overflow: hidden;
}
.bar-fill { height: 100%; background: var(--gold); }

/* Fund item — row on paper (fund lists) */
.fund-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.fund-item .fund-name { font-size: var(--fs-sm); color: var(--ink); }
.fund-item .fund-sub  { font-size: var(--fs-mono-sm); color: var(--ink-muted); margin-top: 2px; }
.fund-list-title {
  font-family: var(--font-mono);
  font-size: var(--fs-mono-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

/* AI observation note (paper) */
.ai-note {
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: #EFEAD9;
  display: flex; gap: 10px; align-items: flex-start;
  font-size: var(--fs-label); color: #4E4B3F; line-height: var(--lh-body);
}
.ai-note .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-top: 5px; flex: none; }

/* Buttons */
.btn-primary {
  background: var(--indigo-900); color: var(--paper);
  padding: 14px 26px; border-radius: var(--radius-pill);
  font-size: var(--fs-body); font-weight: 500; border: none; cursor: pointer;
  font-family: var(--font-body);
}
.btn-ghost {
  color: var(--ink); padding: 14px 8px;
  font-size: var(--fs-body); font-weight: 500;
  border: none; border-bottom: 1px solid var(--ink); background: none; cursor: pointer;
}
.nav-cta {
  background: var(--indigo-900); color: var(--paper);
  padding: 10px 20px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 500;
}

/* Display heading helper */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
}
.display em { font-style: italic; color: var(--indigo-800); }
