/*
 * TraderHome design tokens — one source of truth for every route.
 *
 * Every product page keeps its own stylesheet, but those stylesheets only
 * consume their local variables (--rv-*, --io-*, --tt-*, --ms-*, …).
 * traderhome-unify.css maps those local variables onto the tokens below, so
 * changing a value here re-skins the whole site.
 *
 * Rules
 *  - Surfaces step up in lightness: bg → surface-1 → surface-2 → surface-3.
 *  - One accent per product (--th-accent, set from <html data-th-stage>),
 *    used for navigation markers, eyebrows, active tabs and primary buttons.
 *  - Semantic colours (up / down / warn / info) never change per product and
 *    are always paired with a text label.
 *  - Text never goes below 12px; only uppercase mono labels may use 11px.
 */
:root {
  color-scheme: dark;

  /* Surfaces */
  --th-bg: #080c14;
  --th-bg-glow: rgba(56, 120, 220, .10);
  --th-surface-1: #0d131e;
  --th-surface-2: #111925;
  --th-surface-3: #172131;
  --th-input: #0a1019;
  --th-line: rgba(148, 163, 184, .16);
  --th-line-strong: rgba(148, 163, 184, .30);

  /* Text */
  --th-text: #eef2f8;
  --th-text-2: #c4cedb;
  --th-muted: #93a1b4;
  --th-faint: #6e7b8d;

  /* Brand + per-product accents (similar lightness, distinct hue) */
  --th-brand: #67e8f9;
  --th-accent-history: #67d8ef;
  --th-accent-review: #b4a5fb;
  --th-accent-incomeos: #5ee0d2;
  --th-accent-tailtrend: #74e3ad;
  --th-accent-otc: #8ab4ff;
  --th-accent-market: #b9e06e;
  --th-accent-daily: #f3a6d0;
  --th-accent: var(--th-brand);
  --th-on-accent: #061018;

  /* Semantic */
  --th-up: #4fd18b;
  --th-down: #f07a85;
  --th-warn: #f2bf5e;
  --th-info: #7aaeff;
  --th-up-bg: rgba(79, 209, 139, .10);
  --th-down-bg: rgba(240, 122, 133, .10);
  --th-warn-bg: rgba(242, 191, 94, .10);
  --th-info-bg: rgba(122, 174, 255, .10);

  /* Typography */
  --th-font: Inter, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --th-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --th-fs-label: 11px;   /* uppercase mono labels only */
  --th-fs-xs: 12px;      /* captions, table meta */
  --th-fs-sm: 13px;      /* secondary text, chips */
  --th-fs-md: 14px;      /* dense body, tables, buttons */
  --th-fs-base: 16px;    /* reading body */
  --th-fs-lg: 18px;      /* card titles */
  --th-fs-xl: 22px;      /* section titles inside tools */
  --th-fs-2xl: 28px;     /* page section headings */
  --th-fs-3xl: 36px;     /* tool page titles */
  --th-fs-hero: clamp(34px, 4.4vw, 56px);
  --th-lh-tight: 1.2;
  --th-lh: 1.6;

  /* Shape + space */
  --th-r-xs: 6px;
  --th-r-sm: 8px;
  --th-r-md: 10px;
  --th-r-lg: 14px;
  --th-r-xl: 20px;
  --th-s1: 4px;
  --th-s2: 8px;
  --th-s3: 12px;
  --th-s4: 16px;
  --th-s5: 24px;
  --th-s6: 32px;
  --th-s7: 48px;
  --th-s8: 64px;
  --th-shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 12px 32px rgba(0, 0, 0, .22);

  /* Layout */
  --th-shell-h: 60px;
  --th-container: 1280px;
  --th-container-wide: 1600px;
  --th-gutter: 32px;
}

html[data-th-stage="history"] { --th-accent: var(--th-accent-history); }
html[data-th-stage="review"] { --th-accent: var(--th-accent-review); }
html[data-th-stage="incomeos"] { --th-accent: var(--th-accent-incomeos); }
html[data-th-stage="tailtrend"] { --th-accent: var(--th-accent-tailtrend); }
html[data-th-stage="otc"] { --th-accent: var(--th-accent-otc); }
html[data-th-stage="marketSimulation"] { --th-accent: var(--th-accent-market); }
html[data-th-stage="dailyTrade"] { --th-accent: var(--th-accent-daily); }

@media (max-width: 680px) {
  :root { --th-gutter: 16px; --th-fs-3xl: 28px; --th-fs-2xl: 24px; }
}

/* Shared freshness badge — used by the shell, the home board and any page. */
.th-fresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid var(--th-line-strong);
  border-radius: 999px;
  color: var(--th-text-2);
  background: var(--th-surface-2);
  font: 600 var(--th-fs-xs)/1.2 var(--th-font);
  white-space: nowrap;
}
.th-fresh::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.th-fresh[data-state="fresh"] { color: var(--th-up); border-color: rgba(79, 209, 139, .35); background: var(--th-up-bg); }
.th-fresh[data-state="late"] { color: var(--th-warn); border-color: rgba(242, 191, 94, .38); background: var(--th-warn-bg); }
.th-fresh[data-state="stale"] { color: var(--th-down); border-color: rgba(240, 122, 133, .38); background: var(--th-down-bg); }
/* A research edition is up to date but must not be acted on: its own colour, never the "late" amber. */
.th-fresh[data-state="research"] { color: var(--th-info); border-color: rgba(122, 174, 255, .38); background: var(--th-info-bg); }
.th-fresh[data-state="idle"],
.th-fresh[data-state="unknown"],
.th-fresh[data-state="paused"] { color: var(--th-muted); }
