/* AlpaTrade "First light" design tokens.
 *
 * One stylesheet for every page. The terminal sets data-theme on <html>
 * (light | dark) before first paint; the marketing site is always the light
 * world with its own dark bands and sets its colours explicitly.
 * Every text pair below was checked at 4.5:1 or better in both themes.
 */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #EEF1EC; --bar: #F7F8F4; --side: #F3F5F0; --surface: #FFFFFF;
  --line: rgba(16,38,29,.09); --line-strong: rgba(16,38,29,.16);
  --ink: #10261D; --body: #2C4337; --muted: #4F6559;
  --btn: #10261D; --btn-ink: #F6F1E2; --focus: #1F5D43; --accent: #1F5D43;
  --sun: #C99A3A; --gold: #7E5F16; --dawn: #F2DFA8;
  --pos: #1B6B42; --neg: #A23B2A;
  --chart: #10261D; --chart-fan: #2F5A49; --spy: #4F6559;
  --chip-paper-bg: #10261D; --chip-paper-ink: #F6F1E2;
  --chip-backtest-bg: #E3E9E3; --chip-backtest-ink: #10261D;
  --advisor-bg: #10261D; --advisor-ink: #EEF2EC; --advisor-muted: #A9C2B5;
  --toggle-bg: rgba(16,38,29,.07);
  --tint: rgba(16,38,29,.05);
  --accent-tint: rgba(31,93,67,.12);
  --dawn-tint: rgba(242,223,168,.5);
  --shadow-pop: 0 18px 48px rgba(16,38,29,.16);

  /* Typography */
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-sans: var(--font-body);

  /* Radii */
  --r-control: 10px; --r-panel: 18px; --r-card: 20px; --r-pill: 999px;

  /* Legacy aliases: older feature modules read these names. */
  --bg-elev: var(--surface); --bg-raise: var(--side);
  --ink-muted: var(--muted); --ink-dim: var(--muted);
  --line-br: var(--line-strong);
  --accent-dim: var(--accent-tint); --accent-deep: #164A35; --accent-ink: #F6F1E2;
  --red: var(--neg); --green: var(--pos); --danger: var(--neg);
  --text: var(--ink); --panel: var(--surface); --panel-2: var(--side); --paper: var(--surface);
  --radius: var(--r-control); --accent-2: var(--sun);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1813; --bar: #0D1C16; --side: #0D1C16; --surface: #12251D;
  --line: rgba(241,238,226,.08); --line-strong: rgba(241,238,226,.18);
  --ink: #F1EEE2; --body: #CFDAD2; --muted: #A3B5AA;
  --btn: #F2DFA8; --btn-ink: #10261D; --focus: #F2DFA8; --accent: #F2DFA8;
  --sun: #F2DFA8; --gold: #F2DFA8; --dawn: #F2DFA8;
  --pos: #8FD8AE; --neg: #F2A48C;
  --chart: #F2DFA8; --chart-fan: #C9D6CC; --spy: #A3B5AA;
  --chip-paper-bg: #F2DFA8; --chip-paper-ink: #10261D;
  --chip-backtest-bg: rgba(241,238,226,.1); --chip-backtest-ink: #F1EEE2;
  --advisor-bg: #F1EEE2; --advisor-ink: #10261D; --advisor-muted: #4A5F53;
  --toggle-bg: rgba(241,238,226,.08);
  --tint: rgba(241,238,226,.05);
  --accent-tint: rgba(242,223,168,.12);
  --dawn-tint: rgba(242,223,168,.14);
  --shadow-pop: 0 18px 48px rgba(0,0,0,.45);
  --accent-deep: #E9D394; --accent-ink: #10261D;
}

/* ── Browser surfaces ───────────────────────────────────────────── */
::selection { background: var(--btn); color: var(--btn-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
html { scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
input, textarea, select { caret-color: var(--accent); }

/* Numbers line up everywhere in the terminal. */
.num, .fl-num, table { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Shared terminal components (fl-*) ──────────────────────────── */
.fl-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-style: normal;
  font-size: clamp(34px, 3.2vw, 46px); line-height: 1.04; letter-spacing: .012em; word-spacing: .04em; color: var(--ink); }
.fl-title.sm { font-size: 38px; }
.fl-sub { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.fl-h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: 0; }
.fl-card { background: var(--surface); border-radius: var(--r-card); box-shadow: 0 0 0 1px var(--line); min-width: 0; }
.fl-panel { background: var(--surface); border-radius: var(--r-panel); box-shadow: 0 0 0 1px var(--line); min-width: 0; }

.fl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 0 18px; border: 0; border-radius: var(--r-pill); background: var(--btn); color: var(--btn-ink);
  font: 700 14px/1 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: filter .15s ease, background-color .15s ease, box-shadow .15s ease; }
.fl-btn:hover { filter: brightness(1.12); }
[data-theme="dark"] .fl-btn:hover { filter: brightness(1.05); }
.fl-btn:disabled, .fl-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }
.fl-btn.secondary { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line-strong) inset; }
.fl-btn.secondary:hover { filter: none; background: var(--side); }
.fl-btn.quiet { background: transparent; color: var(--ink); font-weight: 600; }
.fl-btn.quiet:hover { filter: none; background: var(--tint); }
.fl-btn.lg { min-height: 46px; padding: 0 22px; font-size: 14.5px; }

.fl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.fl-chip.paper { background: var(--chip-paper-bg); color: var(--chip-paper-ink); }
.fl-chip.backtest { background: var(--chip-backtest-bg); color: var(--chip-backtest-ink); }
.fl-chip.live { background: var(--dawn); color: #10261D; }
.fl-chip.muted { background: var(--tint); color: var(--muted); }

.fl-table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--ink); }
.fl-table caption { text-align: left; padding: 14px 18px 6px; font-weight: 700; font-size: 14px; color: var(--ink); }
.fl-table th { text-align: left; padding: 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.fl-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.fl-table :is(th, td):first-child { padding-left: 20px; }
.fl-table :is(th, td):last-child { padding-right: 20px; }
.fl-table .r { text-align: right; }
.fl-table .strong { font-weight: 600; }
.fl-table-wrap { overflow-x: auto; }
.fl-slug { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.fl-note { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); }

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