/* ============================================================
   BuiltForX — Design System Tokens
   Dark · warm · creator-friendly · green growth accent
   Apple (SF Pro) typography · IST-native analytics product
   ============================================================ */

/* ---- SF Pro font faces (upload font files to /fonts/ to activate) ----
   Until uploaded, the fallback stack renders:
   -apple-system / BlinkMacSystemFont resolve to SF Pro on macOS/iOS natively.
   On other platforms Helvetica Neue / Arial serve as fallbacks.              */
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SF-Pro-Display-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SF-Pro-Display-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SF-Pro-Display-Semibold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/SF-Pro-Display-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Text";
  src: url("fonts/SF-Pro-Text-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Text";
  src: url("fonts/SF-Pro-Text-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Text";
  src: url("fonts/SF-Pro-Text-Semibold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- Type families ------------------------------------- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* ---- Warm dark neutrals (slight olive undertone) -------- */
  --bg:               oklch(0.165 0.006 120);   /* page */
  --bg-deep:          oklch(0.135 0.006 120);   /* deepest wells, footers */
  --surface:          oklch(0.205 0.008 120);   /* cards */
  --surface-raised:   oklch(0.245 0.009 120);   /* nested / hover */
  --surface-overlay:  oklch(0.285 0.010 120);   /* popovers, menus */
  --border:           oklch(0.305 0.008 120);
  --border-strong:    oklch(0.385 0.010 120);
  --border-faint:     oklch(0.255 0.007 120);

  /* ---- Text ---------------------------------------------- */
  --text:             oklch(0.965 0.006 110);
  --text-secondary:   oklch(0.745 0.010 115);
  --text-muted:       oklch(0.585 0.010 115);
  --text-faint:       oklch(0.460 0.008 115);
  --text-on-accent:   oklch(0.205 0.045 150);

  /* ---- Green accent (growth · money · UPI) --------------- */
  --accent:           oklch(0.800 0.165 150);
  --accent-hover:     oklch(0.845 0.170 150);
  --accent-pressed:   oklch(0.735 0.158 150);
  --accent-text:      oklch(0.860 0.150 150);   /* green text on dark */
  --accent-subtle:    oklch(0.300 0.052 150);   /* tinted fill */
  --accent-subtle-hi: oklch(0.355 0.070 150);
  --accent-line:      oklch(0.470 0.090 150);   /* tinted border */

  /* ---- Marigold / amber (warmth · secondary series) ------ */
  --warm:             oklch(0.820 0.150 75);
  --warm-text:        oklch(0.855 0.130 75);
  --warm-subtle:      oklch(0.330 0.055 70);
  --warm-line:        oklch(0.480 0.090 72);

  /* ---- Semantic ------------------------------------------ */
  --positive:         oklch(0.800 0.165 150);
  --positive-text:    oklch(0.860 0.150 150);
  --negative:         oklch(0.700 0.170 25);
  --negative-text:    oklch(0.785 0.150 27);
  --negative-subtle:  oklch(0.320 0.070 27);
  --warning:          oklch(0.820 0.150 75);
  --info:             oklch(0.760 0.110 232);
  --info-text:        oklch(0.820 0.090 232);

  /* ---- Chart series (multi) ------------------------------ */
  --series-1: oklch(0.800 0.165 150);  /* green   */
  --series-2: oklch(0.820 0.150 75);   /* marigold*/
  --series-3: oklch(0.720 0.160 25);   /* coral   */
  --series-4: oklch(0.730 0.140 300);  /* violet  */
  --series-5: oklch(0.800 0.110 210);  /* cyan    */

  /* ---- Plan tiers ---------------------------------------- */
  --tier-free:    oklch(0.585 0.010 115);
  --tier-creator: oklch(0.800 0.165 150);
  --tier-pro-a:   oklch(0.800 0.165 150);
  --tier-pro-b:   oklch(0.820 0.150 75);
  --tier-pro: linear-gradient(110deg, var(--tier-pro-a), var(--tier-pro-b));

  /* ---- Radii (rounded · approachable) -------------------- */
  --radius-sm:   8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 28px;
  --radius-full: 999px;

  /* ---- Spacing (4px base) -------------------------------- */
  --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;

  /* ---- Shadows (dark · soft) ----------------------------- */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.40), 0 1px 1px rgba(0,0,0,0.30);
  --shadow-md: 0 6px 20px -6px rgba(0,0,0,0.55), 0 2px 6px -2px rgba(0,0,0,0.40);
  --shadow-lg: 0 18px 48px -12px rgba(0,0,0,0.66), 0 6px 16px -8px rgba(0,0,0,0.50);
  --shadow-accent: 0 10px 34px -8px oklch(0.800 0.165 150 / 0.42);
  --ring-accent: 0 0 0 3px oklch(0.800 0.165 150 / 0.30); /* @kind shadow */
  --hairline: inset 0 1px 0 0 oklch(1 0 0 / 0.04); /* @kind shadow */

  /* ---- Type scale (size / line / tracking) --------------- */
  --fs-display-xl: 72px;  --lh-display-xl: 1.03 /* @kind other */; --tr-display-xl: -0.032em /* @kind other */;
  --fs-display:    56px;  --lh-display:    1.06 /* @kind other */; --tr-display:    -0.026em /* @kind other */;
  --fs-h1:         40px;  --lh-h1:         1.10 /* @kind other */; --tr-h1:         -0.021em /* @kind other */;
  --fs-h2:         32px;  --lh-h2:         1.16 /* @kind other */; --tr-h2:         -0.018em /* @kind other */;
  --fs-h3:         24px;  --lh-h3:         1.25 /* @kind other */; --tr-h3:         -0.014em /* @kind other */;
  --fs-h4:         20px;  --lh-h4:         1.32 /* @kind other */; --tr-h4:         -0.010em /* @kind other */;
  --fs-body-lg:    19px;  --lh-body-lg:    1.55 /* @kind other */; --tr-body-lg:    -0.005em /* @kind other */;
  --fs-body:       17px;  --lh-body:       1.55 /* @kind other */; --tr-body:        0 /* @kind other */;
  --fs-body-sm:    15px;  --lh-body-sm:    1.50 /* @kind other */; --tr-body-sm:     0 /* @kind other */;
  --fs-caption:    13px;  --lh-caption:    1.40 /* @kind other */; --tr-caption:     0.002em /* @kind other */;
  --fs-micro:      11px;  --lh-micro:      1.30 /* @kind other */; --tr-micro:       0.06em /* @kind other */;

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* @kind other */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* @kind other */
}

/* ============================================================
   Base / reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: oklch(0.800 0.165 150 / 0.30); color: var(--text); }

/* ============================================================
   Typographic utilities
   ============================================================ */
.t-display-xl { font-size: var(--fs-display-xl); line-height: var(--lh-display-xl); letter-spacing: var(--tr-display-xl); font-weight: 600; }
.t-display    { font-size: var(--fs-display);    line-height: var(--lh-display);    letter-spacing: var(--tr-display);    font-weight: 600; }
.t-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--tr-h1); font-weight: 600; }
.t-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--tr-h2); font-weight: 600; }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--tr-h3); font-weight: 600; }
.t-h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); letter-spacing: var(--tr-h4); font-weight: 600; }
.t-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); letter-spacing: var(--tr-body-lg); }
.t-body    { font-size: var(--fs-body);    line-height: var(--lh-body); }
.t-body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); }
.t-caption { font-size: var(--fs-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.t-micro {
  font-size: var(--fs-micro); line-height: var(--lh-micro);
  letter-spacing: var(--tr-micro); font-weight: 600; text-transform: uppercase;
}

.t-secondary { color: var(--text-secondary); }
.t-muted { color: var(--text-muted); }
.t-faint { color: var(--text-faint); }
.t-accent { color: var(--accent-text); }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ============================================================
   Reusable primitives used by cards & templates
   ============================================================ */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--hairline);
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--radius-full);
  font-size: var(--fs-caption); font-weight: 600; line-height: 1;
  background: var(--surface-raised); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.pill--accent {
  background: var(--accent-subtle); color: var(--accent-text);
  border-color: var(--accent-line);
}

a { color: inherit; }
