/* ============================================================
   ezpztrader.com — design tokens · palette "EZPZ Violet"
   Neutral near-black surfaces and purple actions connect the EZPZ ecosystem.
   Red remains reserved for sell, losses and errors; status tones retain
   their semantic roles. Premium gradients and glows use purple only for decorative accents.

   Dark is the default (server-rendered data-theme, see
   common/context_processors.py); light is designed, not inverted.
   Palette keys, labels and the --bg/--ink values used by the critical
   CSS and theme-color meta live in common/palettes.py; keep the two in
   step (common.tests.PaletteSourceTests checks it).

   The legacy names further down (--accent, --gold, --line,
   --bg-raised …) are PERMANENT aliases: older CSS and
   static/js/journal-ai-chat.js (getComputedStyle) read them.
   ============================================================ */

/* Cascade layers, weakest first (ECOSYSTEM_REDESIGN.md §6.5). `legacy` holds every
   pre-redesign rule unchanged; rules move out of it as their page is rebuilt. */
@layer legacy, tokens, base, components, shell, page, motion;

@layer legacy {

:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  /* surfaces */
  --canvas: #060608;
  --bg: #09090B;
  --surface: #111114;
  --raised: #18181C;
  --surface-hover: #202025;
  --sunken: #060608;
  --overlay: rgba(6, 6, 8, .72);

  /* ink */
  --ink: #F7F7FA;
  --ink-2: #D3D3DC;
  --ink-3: #9999A6;

  /* lines */
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .15);
  --border-brand: rgba(148, 103, 254, .26);
  --input-border: #757580;

  /* Purple ecosystem actions use accessible white labels. */
  --action: #7C4DDE;
  --action-hover: #6D3FD1;
  --on-action: #FFFFFF;
  --action-soft: rgba(124, 77, 222, .18);
  --action-ink: #A883FF;
  --link-hover: #C4A3FF;
  --action-border: transparent;
  --focus: #9467FE;

  /* brand */
  --brand: #9467FE;
  --brand-soft: rgba(148, 103, 254, .14);

  /* money / market direction */
  --buy: #2BC4A4;
  --buy-soft: rgba(43, 196, 164, .12);
  --sell: #F5475A;
  --sell-soft: rgba(245, 71, 90, .12);

  /* status tones */
  --ok: #2BC4A4;      --ok-soft: rgba(43, 196, 164, .12);
  --warn: #F0B44C;    --warn-soft: rgba(240, 180, 76, .13);
  --danger: #F5475A;  --danger-soft: rgba(245, 71, 90, .12);
  --on-danger: #1A0507;
  --info: #6AA7FF;    --info-soft: rgba(106, 167, 255, .13);
  --neutral: #9999A6; --neutral-soft: rgba(148, 163, 166, .14);
  --live: #F0B44C;    --live-soft: rgba(240, 180, 76, .13);
  /* ZPZ coin gold (EZPZ_STRATEGIES.md): the coin's own colour, same in every palette. */
  --zpz: #F2C14E;     --zpz-soft: rgba(242, 193, 78, .12); --zpz-line: rgba(242, 193, 78, .45);

  /* code */
  --code-bg: #060608;
  --code-ink: #DAE7E8;
  /* JSON syntax colours (docs.js .tok-*): code blocks sit on --code-bg, dark in both themes. */
  --code-key: #FDBA74;
  --code-str: #86EFAC;
  --code-num: #FCD34D;
  --code-lit: #C4B5FD;

  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .5);
  --shadow-pop: 0 8px 32px rgba(0, 0, 0, .45);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .25);
  --on-buy: #03120E;
  /* logo mark colours (designer's file, 2026-11-24): only for drawing the logo itself */
  --logo-up: #089981;
  --logo-down: #F23645;
  --logo-ink: #FFFFFF;
  --on-sell: #1A0507;
  --knob: #FFFFFF;
  /* premium layer (2026-11-25): gradient CTA, lit hero, card sheen and spotlight.
     Purple ecosystem light on neutral surfaces; every value is themed. */
  --grad-action: linear-gradient(135deg, #8455EA 0%, #7C4DDE 50%, #6B3CCC 100%);
  --grad-action-hover: linear-gradient(135deg, #7C4DDE 0%, #6B3CCC 100%);
  --shadow-action: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 24px -8px rgba(148, 103, 254, .6);
  --grad-accent-text: linear-gradient(92deg, #E7DBFF 0%, #C4A3FF 30%, #9467FE 62%, #8455EA 100%);
  --hero-glow:
    radial-gradient(46% 62% at 28% 0%, rgba(148, 103, 254, .28), transparent 70%),
    radial-gradient(40% 56% at 74% 0%, rgba(124, 77, 222, .18), transparent 70%);
  --grid-line: rgba(255, 255, 255, .045);
  --card-sheen: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%);
  --sweep: linear-gradient(90deg, transparent, #7C4DDE 25%, #9467FE 50%, #B68CFF 80%, transparent);
  --spot: rgba(148, 103, 254, .13);
}

:root[data-theme="light"] {
  color-scheme: light;

  --canvas: #EFEFF3;
  --bg: #F7F7FA;
  --surface: #FFFFFF;
  --raised: #FFFFFF;
  --surface-hover: #F2F2F6;
  --sunken: #EFEFF3;
  --overlay: rgba(23, 23, 28, .42);

  --ink: #17171C;
  --ink-2: #4C4C58;
  --ink-3: #626270;

  --border: #E1E1E8;
  --border-strong: #CACAD4;
  --border-brand: rgba(109, 63, 209, .28);
  --input-border: #8B8B98;

  --action: #6D3FD1;
  --action-hover: #5B30C2;
  --on-action: #FFFFFF;
  --action-soft: rgba(109, 63, 209, .10);
  --action-ink: #5B30C2;
  --link-hover: #4A23A8;
  --action-border: transparent;
  --focus: #6D3FD1;

  --brand: #6A45E6;
  --brand-soft: rgba(109, 63, 209, .10);

  --buy: #06735F;
  --buy-soft: rgba(6, 115, 95, .10);
  --sell: #C8202F;
  --sell-soft: rgba(200, 32, 47, .09);

  --ok: #06735F;      --ok-soft: rgba(6, 115, 95, .10);
  --warn: #9A5B00;    --warn-soft: rgba(154, 91, 0, .10);
  --danger: #C8202F;  --danger-soft: rgba(200, 32, 47, .09);
  --on-danger: #FFFFFF;
  --info: #2456C7;    --info-soft: rgba(36, 86, 199, .10);
  --neutral: #626270; --neutral-soft: rgba(82, 105, 109, .10);
  --live: #9A5B00;    --live-soft: rgba(154, 91, 0, .10);
  /* ZPZ coin graphite in light, as on zpzcoin.io. */
  --zpz: #3A3A44;     --zpz-soft: rgba(58, 58, 68, .07);   --zpz-line: rgba(58, 58, 68, .35);

  --code-bg: #18181C;
  --code-ink: #DAE7E8;
  --code-key: #FDBA74;
  --code-str: #86EFAC;
  --code-num: #FCD34D;
  --code-lit: #C4B5FD;

  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, .7);
  --shadow-1: 0 1px 2px rgba(23, 23, 28, .06);
  --shadow-2: 0 16px 40px rgba(23, 23, 28, .10);
  --shadow-pop: 0 8px 32px rgba(23, 23, 28, .14);
  --shadow-xs: 0 1px 2px rgba(23, 23, 28, .18);
  --on-buy: #FFFFFF;
  --logo-up: #089981;
  --logo-down: #F23645;
  --logo-ink: #000000;
  --on-sell: #FFFFFF;
  --knob: #FFFFFF;
  --grad-action: linear-gradient(135deg, #7E50E6 0%, #6D3FD1 50%, #5B30C2 100%);
  --grad-action-hover: linear-gradient(135deg, #6D3FD1 0%, #5B30C2 100%);
  --shadow-action: inset 0 1px 0 rgba(255, 255, 255, .28), 0 8px 22px -10px rgba(109, 63, 209, .55);
  --grad-accent-text: linear-gradient(92deg, #6D3FD1 0%, #5B30C2 45%, #6A45E6 100%);
  --hero-glow:
    radial-gradient(46% 62% at 28% 0%, rgba(124, 77, 222, .16), transparent 70%),
    radial-gradient(40% 56% at 74% 0%, rgba(124, 77, 222, .11), transparent 70%);
  --grid-line: rgba(23, 23, 28, .055);
  --card-sheen: linear-gradient(180deg, rgba(124, 77, 222, .025), transparent 40%);
  --sweep: linear-gradient(90deg, transparent, #6D3FD1 25%, #6A45E6 50%, #7E50E6 80%, transparent);
  --spot: rgba(109, 63, 209, .07);
}

/* ---- PERMANENT legacy aliases (do not delete; see header) ---- */
:root {
  --bg-sunken: var(--sunken);
  --bg-raised: var(--raised);
  --bg-elevated: var(--raised);
  --ink-soft: var(--ink-2);
  --ink-faint: var(--ink-3);
  --line: var(--border);
  --line-soft: var(--border);

  --accent: var(--brand);
  --accent-strong: var(--brand);
  --accent-ink: var(--brand);
  --accent-soft: var(--brand-soft);

  --gold: var(--warn);
  --gold-ink: var(--ink);
  --gold-soft: var(--live-soft);
}

:root {
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-pill: 999px;

  --font-display: "Inter", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1500px;
  --measure: 66ch;

  /* motion (ECOSYSTEM_REDESIGN.md §9.4): no bounce or overshoot anywhere */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --dur-instant: 120ms;
  --dur-quick: 200ms;
  --dur-panel: 320ms;
  --dur-reveal: 560ms;
  --dur-hero: 900ms;
  --stagger: 60ms;

  /* type scale (names kept from DESIGN_SYSTEM.md) */
  --text-2xs: 0.6875rem;  /* 11 */
  --text-xs: 0.75rem;     /* 12 */
  --text-sm: 0.8125rem;   /* 13 */
  --text-base: 0.875rem;  /* 14 */
  --text-md: 0.9375rem;   /* 15 */
  --text-lg: 1rem;        /* 16 */
  --text-xl: 1.125rem;    /* 18 */
  --text-2xl: 1.25rem;    /* 20 */
  --text-3xl: 1.5rem;     /* 24 */
  --text-4xl: 1.75rem;    /* 28 */
  --text-5xl: 2.25rem;    /* 36 */

  /* Public headings and leads match ezpzinvesting.com (src/styles/globals.css):
     display 44-72px, h1 36-56px, h2 28-40px, h3 20px, lead 17px, -0.022em on
     headings and -0.011em on body. The app keeps its compact scale (.is-app below). */
  --text-display: clamp(2.75rem, 6vw, 4.5rem);
  --text-h1: clamp(2.25rem, 4.6vw, 3.5rem);
  --text-h2: clamp(1.75rem, 3.6vw, 2.5rem);
  --text-h3: 1.25rem;
  --text-lead: 1.0625rem;
  --tracking-tight: -0.022em;
  --tracking-body: -0.011em;

  /* weights, tuned for Inter's variable axis */
  --weight-normal: 400;
  --weight-medium: 510;
  --weight-semi: 590;
  --weight-bold: 680;

  --leading-none: 1;
  --leading-tight: 1.08;
  --leading-heading: 1.25;
  --leading-snug: 1.4;
  --leading-relaxed: 1.5;
  --leading-normal: 1.6;
  --leading-loose: 1.7;

  /* spacing, 4px grid */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-9: 2.25rem;
  --space-10: 2.5rem;
  --space-11: 2.75rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-18: 4.5rem;

  /* controls */
  --control-sm: 32px;
  --control-md: 36px;
  --control-lg: 44px;

  /* page rhythm */
  --gutter: clamp(1rem, 2vw, 1.5rem);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --section-y-tight: clamp(2.5rem, 5vw, 4rem);

  /* shell */
  --sidebar-w: 232px;
  --rail-w: 64px;
  --topbar-h: 64px;
  --header-h: 64px;

  /* layers */
  --z-sticky: 20;
  --z-topbar: 40;
  --z-header: 60;
  --z-scrim: 70;
  --z-drawer: 80;
  --z-popover: 90;
  --z-modal: 100;
  --z-toast: 150;
  --z-skip: 200;
  --z-tooltip: 300;
  /* Breakpoints (docs only): 480 · 640 · 900 (drawer; nav.js uses 901) · 1280 · 1536 */
}

@media (max-width: 640px) {
  :root { --section-y: clamp(3rem, 11vw, 4.5rem); }
}

/* App: compact type for data screens. */
:root.is-app {
  --text-display: clamp(2.4rem, 5vw, 3.6rem);
  --text-h1: clamp(1.9rem, 3.4vw, 2.6rem);
  --text-h2: clamp(1.6rem, 3vw, 2.1rem);
  --text-h3: var(--text-xl);
  --text-lead: var(--text-lg);
  --tracking-body: 0;
  /* Workspace summaries use readable proportional figures; trading cells
     retain --font-mono and their compact, aligned scale. */
  --workspace-heading-size: var(--text-4xl);
  --workspace-metric-size: var(--text-3xl);
  --workspace-metric-min: 11rem;
  --workspace-pad: clamp(1rem, 2.3vw, 2rem);
}

} /* @layer legacy */
