/* nrg.market — design tokens
   Stage 01. Single source of colour, size, motion. No hardcoded values downstream.
   Default theme: dark. Follows the OS unless [data-theme] is set explicitly. */

:root {
  /* ---- type ---- */
  --nrg-font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nrg-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --nrg-text-2xs: 11px;
  --nrg-text-xs: 12px;
  --nrg-text-sm: 13px;
  --nrg-text-md: 15px;
  --nrg-text-lg: 17px;
  --nrg-text-xl: 20px;
  --nrg-text-2xl: 24px;
  --nrg-text-3xl: 32px;
  --nrg-text-4xl: 40px;

  --nrg-leading-tight: 1.15;
  --nrg-leading-normal: 1.5;
  --nrg-leading-loose: 1.65;

  --nrg-weight-regular: 400;
  --nrg-weight-medium: 560;
  --nrg-weight-semibold: 620;

  --nrg-tracking-caps: 0.08em;
  --nrg-tracking-tight: -0.02em;

  /* ---- space (4px step) ---- */
  --nrg-space-1: 4px;
  --nrg-space-2: 8px;
  --nrg-space-3: 12px;
  --nrg-space-4: 16px;
  --nrg-space-6: 24px;
  --nrg-space-8: 32px;
  --nrg-space-12: 48px;
  --nrg-space-16: 64px;

  /* ---- radius ---- */
  --nrg-radius-sm: 3px;
  --nrg-radius: 4px;
  --nrg-radius-lg: 8px;
  --nrg-radius-full: 999px;

  /* ---- density: row height + row padding + label size ---- */
  --nrg-row-site: 52px;
  --nrg-row-app: 44px;
  --nrg-row-ops: 32px;
  --nrg-row-pad-site: 15px;
  --nrg-row-pad-app: 11px;
  --nrg-row-pad-ops: 6px;
  --nrg-tap-min: 44px;          /* never smaller on touch */

  /* ---- borders & focus ---- */
  --nrg-border-width: 1px;
  --nrg-focus-width: 2px;
  --nrg-focus-offset: 2px;

  /* ---- motion ---- */
  --nrg-ease: cubic-bezier(0.2, 0, 0, 1);
  --nrg-duration-fast: 120ms;
  --nrg-duration: 180ms;
  --nrg-duration-slow: 320ms;
  --nrg-flash-duration: 1600ms;  /* new row highlight */

  /* ---- layout ---- */
  --nrg-container: 1180px;
  --nrg-measure: 64ch;
  --nrg-bp-sm: 480px;
  --nrg-bp-md: 720px;
  --nrg-bp-lg: 1024px;
  --nrg-bp-xl: 1360px;

  --nrg-z-sticky: 20;
  --nrg-z-overlay: 40;
  --nrg-z-modal: 50;
  --nrg-z-toast: 60;
}

/* ---------- dark: the default ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --nrg-bg: #0B0E12;
  --nrg-surface: #151A20;
  --nrg-surface-2: #1B2128;
  --nrg-surface-hover: #1F262E;
  --nrg-line: #2A333B;
  --nrg-line-soft: #1E252B;

  --nrg-text: #E6EAEF;
  --nrg-text-muted: #A6B1BA;
  --nrg-text-dim: #7C8892;

  --nrg-accent: #3FC7AC;
  --nrg-accent-hover: #55D8BE;
  --nrg-accent-ink: #06231E;
  --nrg-accent-soft: #10322C;

  --nrg-info: #74A9F5;
  --nrg-info-soft: #14243D;
  --nrg-ok: #4BC07E;
  --nrg-ok-soft: #102C1E;
  --nrg-warn: #E0A73C;
  --nrg-warn-soft: #2E2413;
  --nrg-danger: #F2705F;
  --nrg-danger-soft: #331915;
  --nrg-neutral: #8B98A2;
  --nrg-neutral-soft: #1E252B;

  --nrg-focus-ring: #7FE0CB;
  --nrg-flash: #10322C;
  --nrg-tip-bg: #E6EAEF;
  --nrg-tip-text: #0B0E12;
}

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

  --nrg-bg: #F7F8F9;
  --nrg-surface: #FFFFFF;
  --nrg-surface-2: #EDF0F1;
  --nrg-surface-hover: #F3F7F6;
  --nrg-line: #D6DBDE;
  --nrg-line-soft: #E9ECEE;

  --nrg-text: #0E1116;
  --nrg-text-muted: #3C464D;
  --nrg-text-dim: #5B666E;

  --nrg-accent: #0F6B5E;
  --nrg-accent-hover: #0A4F45;
  --nrg-accent-ink: #FFFFFF;
  --nrg-accent-soft: #E7F1EF;

  --nrg-info: #1F5FBF;
  --nrg-info-soft: #E8F0FC;
  --nrg-ok: #136B41;
  --nrg-ok-soft: #E6F3EC;
  --nrg-warn: #8A5200;
  --nrg-warn-soft: #FBF1E0;
  --nrg-danger: #A82318;
  --nrg-danger-soft: #FBEBE9;
  --nrg-neutral: #7C8790;
  --nrg-neutral-soft: #F0F2F3;

  --nrg-focus-ring: #0F6B5E;
  --nrg-flash: #E3F5EF;
  --nrg-tip-bg: #0E1116;
  --nrg-tip-text: #E6EAEF;
}

/* System preference wins when the user has not chosen a theme. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;

    --nrg-bg: #F7F8F9;
    --nrg-surface: #FFFFFF;
    --nrg-surface-2: #EDF0F1;
    --nrg-surface-hover: #F3F7F6;
    --nrg-line: #D6DBDE;
    --nrg-line-soft: #E9ECEE;

    --nrg-text: #0E1116;
    --nrg-text-muted: #3C464D;
    --nrg-text-dim: #5B666E;

    --nrg-accent: #0F6B5E;
    --nrg-accent-hover: #0A4F45;
    --nrg-accent-ink: #FFFFFF;
    --nrg-accent-soft: #E7F1EF;

    --nrg-info: #1F5FBF;
    --nrg-info-soft: #E8F0FC;
    --nrg-ok: #136B41;
    --nrg-ok-soft: #E6F3EC;
    --nrg-warn: #8A5200;
    --nrg-warn-soft: #FBF1E0;
    --nrg-danger: #A82318;
    --nrg-danger-soft: #FBEBE9;
    --nrg-neutral: #7C8790;
    --nrg-neutral-soft: #F0F2F3;

    --nrg-focus-ring: #0F6B5E;
    --nrg-flash: #E3F5EF;
    --nrg-tip-bg: #0E1116;
    --nrg-tip-text: #E6EAEF;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --nrg-duration-fast: 0ms;
    --nrg-duration: 0ms;
    --nrg-duration-slow: 0ms;
    --nrg-flash-duration: 0ms;
  }
}
