/*
 * Lunify design tokens — single source of truth for colors, type, spacing.
 * Copy to web/src/main/resources/static/css/tokens.css.
 * Dark theme is the default; light theme via <html data-theme="light">
 * or automatically when the user prefers light and has not chosen a theme.
 * All text/background pairs below meet WCAG 2.2 AA (see docs/ux/02-design-tokens.md).
 */
:root {
  color-scheme: dark;

  /* ── Surfaces ─────────────────────────────── */
  --lf-bg:            #0B0F17;   /* page */
  --lf-bg-sunken:     #07090E;   /* terminal, code blocks */
  --lf-nav:           #0E131E;   /* sidebar, inputs */
  --lf-surface:       #121826;   /* cards, tables */
  --lf-surface-2:     #182032;   /* hover, nested */
  --lf-selected:      #1B2340;   /* active nav, selected row, chips */
  --lf-border:        #222B3D;
  --lf-border-strong: #2E3A55;   /* inputs, secondary buttons */
  --lf-divider:       #1E2738;

  /* ── Text ─────────────────────────────────── */
  --lf-text:          #E6EAF2;   /* 14.7:1 on surface */
  --lf-text-muted:    #A3ADC2;   /*  7.9:1 */
  --lf-text-subtle:   #8792A8;   /*  5.7:1 – labels, captions */
  --lf-text-on-accent:#0B0F17;   /*  7.6:1 on accent */

  /* ── Brand ────────────────────────────────── */
  --lf-accent:        #8B9CFF;   /* "moonlight" periwinkle, 7.0:1 on surface */
  --lf-accent-hover:  #A3B1FF;
  --lf-link:          #A9B5FF;
  --lf-link-hover:    #C9D1FF;
  --lf-focus-ring:    #C9D1FF;

  /* ── Status (fg / tinted bg) ──────────────── */
  --lf-ok:            #3DD68C;  --lf-ok-bg:       #13261E;
  --lf-warn:          #F5B84A;  --lf-warn-bg:     #2A2212;
  --lf-crit:          #FF7070;  --lf-crit-text:   #FF8A8A;  --lf-crit-bg: #2E171B;
  --lf-info:          #5CC8FF;  --lf-info-text:   #8FD6FF;  --lf-info-bg: #12243A;
  --lf-danger-border: #5A2A33;  --lf-danger-text: #FF9A9A;

  /* ── Data visualisation ───────────────────── */
  --lf-viz-1: #8B9CFF;  /* primary series   */
  --lf-viz-2: #5CC8FF;  /* secondary series */
  --lf-viz-3: #9F8CFF;  /* outbound traffic, paired with viz-2 (dashed line); CVD ΔE 10, normal ΔE 16 */
  --lf-viz-track: #222B3D;
  /* log level bands (phase 9): status colours on purpose — errors must stand out; CVD ΔE 11.6, normal ΔE 18.3 */
  --lf-viz-log-err: #FF7070;  --lf-viz-log-warn: #F5B84A;  --lf-viz-log-info: #6878DC;
  /* sequential heat scale (ATT&CK matrix, host × hour), 0 = none; ink = text on a cell */
  --lf-heat-0: #1B2340;  --lf-heat-1: #3A4C8C;  --lf-heat-2: #4F62A8;  --lf-heat-3: #6679C2;
  --lf-heat-4: #8193DA;  --lf-heat-5: #A9B5EC;  --lf-heat-6: #D3D9FF;
  --lf-heat-ink-low: #E6EAF2;  --lf-heat-ink-high: #0B0F17;

  /* ── Typography ───────────────────────────── */
  --lf-font-sans:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --lf-font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --lf-font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --lf-text-xs:   12px;   /* captions, table headers (uppercase, +0.04em) */
  --lf-text-sm:   13px;   /* secondary text */
  --lf-text-md:   14px;   /* body */
  --lf-text-lg:   16px;   /* card titles */
  --lf-text-xl:   20px;   /* section titles */
  --lf-text-2xl:  24px;
  --lf-text-3xl:  30px;   /* page title (display font) */
  --lf-text-kpi:  32px;   /* KPI numbers (display font) */

  --lf-weight-regular: 400;
  --lf-weight-medium:  500;
  --lf-weight-semibold:600;
  --lf-weight-bold:    700;
  --lf-leading: 1.5;

  /* ── Spacing (4 px grid) ──────────────────── */
  --lf-space-1: 4px;   --lf-space-2: 8px;   --lf-space-3: 12px;  --lf-space-4: 16px;
  --lf-space-5: 20px;  --lf-space-6: 24px;  --lf-space-8: 32px;  --lf-space-10: 40px;

  /* ── Shape & elevation ────────────────────── */
  --lf-radius-sm: 6px;    /* small buttons, tags */
  --lf-radius-md: 8px;    /* buttons, inputs */
  --lf-radius-lg: 12px;   /* cards */
  --lf-radius-xl: 16px;   /* dialogs, login card */
  --lf-radius-pill: 999px;
  --lf-shadow-dialog: 0 24px 64px rgb(0 0 0 / 0.5);

  /* ── Sizing ───────────────────────────────── */
  --lf-control-h: 44px;   /* min touch target for primary controls */
  --lf-control-h-sm: 36px;
  --lf-sidebar-w: 232px;
  --lf-content-max: 1600px;

  /* ── Motion ───────────────────────────────── */
  --lf-ease: cubic-bezier(.2, .8, .2, 1);
  --lf-duration: 160ms;
}

:root[data-theme="light"] {
  color-scheme: light;
  --lf-bg: #F7F8FB;  --lf-bg-sunken: #0E131E;  --lf-nav: #FFFFFF;
  --lf-surface: #FFFFFF;  --lf-surface-2: #F1F3F8;  --lf-selected: #E8EBFF;
  --lf-border: #DDE2EC;  --lf-border-strong: #C5CCDA;  --lf-divider: #E6E9F0;
  --lf-text: #121826;  --lf-text-muted: #4E586D;  --lf-text-subtle: #5F6A80;  --lf-text-on-accent: #FFFFFF;
  --lf-accent: #4C5BD4;  --lf-accent-hover: #3D4BC0;  --lf-link: #4C5BD4;  --lf-link-hover: #3D4BC0;  --lf-focus-ring: #4C5BD4;
  --lf-ok: #137A4B;  --lf-ok-bg: #E7F6EE;
  --lf-warn: #8A5700;  --lf-warn-bg: #FFF4DE;
  --lf-crit: #B42828;  --lf-crit-text: #B42828;  --lf-crit-bg: #FDECEC;
  --lf-info: #0B6197;  --lf-info-text: #0B6197;  --lf-info-bg: #E5F3FC;
  --lf-danger-border: #E3B4B4;  --lf-danger-text: #B42828;
  --lf-viz-1: #4C5BD4;  --lf-viz-2: #0B6197;  --lf-viz-3: #8A4FD6;  --lf-viz-track: #E6E9F0;
  --lf-viz-log-err: #C8383E;  --lf-viz-log-warn: #D9940F;  --lf-viz-log-info: #6E7BD8;
  --lf-heat-0: #EEF0F7;  --lf-heat-1: #D3D9FF;  --lf-heat-2: #B0BCF5;  --lf-heat-3: #8C9BE6;
  --lf-heat-4: #6A7BD2;  --lf-heat-5: #4E5FB8;  --lf-heat-6: #3A4C8C;
  --lf-heat-ink-low: #121826;  --lf-heat-ink-high: #FFFFFF;
  --lf-shadow-dialog: 0 24px 64px rgb(18 24 38 / 0.18);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --lf-bg: #F7F8FB;  --lf-bg-sunken: #0E131E;  --lf-nav: #FFFFFF;
    --lf-surface: #FFFFFF;  --lf-surface-2: #F1F3F8;  --lf-selected: #E8EBFF;
    --lf-border: #DDE2EC;  --lf-border-strong: #C5CCDA;  --lf-divider: #E6E9F0;
    --lf-text: #121826;  --lf-text-muted: #4E586D;  --lf-text-subtle: #5F6A80;  --lf-text-on-accent: #FFFFFF;
    --lf-accent: #4C5BD4;  --lf-accent-hover: #3D4BC0;  --lf-link: #4C5BD4;  --lf-link-hover: #3D4BC0;  --lf-focus-ring: #4C5BD4;
    --lf-ok: #137A4B;  --lf-ok-bg: #E7F6EE;
    --lf-warn: #8A5700;  --lf-warn-bg: #FFF4DE;
    --lf-crit: #B42828;  --lf-crit-text: #B42828;  --lf-crit-bg: #FDECEC;
    --lf-info: #0B6197;  --lf-info-text: #0B6197;  --lf-info-bg: #E5F3FC;
    --lf-danger-border: #E3B4B4;  --lf-danger-text: #B42828;
    --lf-viz-1: #4C5BD4;  --lf-viz-2: #0B6197;  --lf-viz-3: #8A4FD6;  --lf-viz-track: #E6E9F0;
    --lf-viz-log-err: #C8383E;  --lf-viz-log-warn: #D9940F;  --lf-viz-log-info: #6E7BD8;
    --lf-heat-0: #EEF0F7;  --lf-heat-1: #D3D9FF;  --lf-heat-2: #B0BCF5;  --lf-heat-3: #8C9BE6;
    --lf-heat-4: #6A7BD2;  --lf-heat-5: #4E5FB8;  --lf-heat-6: #3A4C8C;
    --lf-heat-ink-low: #121826;  --lf-heat-ink-high: #FFFFFF;
    --lf-shadow-dialog: 0 24px 64px rgb(18 24 38 / 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --lf-duration: 0ms; }
}
