/*
 * Fexa Design System v2 — foundations
 * Version: 2.0.0
 * Stable and namespaced. This file must not style product elements directly.
 */

:root {
  color-scheme: dark;

  /* Font */
  --fx-font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fx-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
  --fx-font-size-caption: 0.75rem;
  --fx-font-size-ui: 0.875rem;
  --fx-font-size-body: 1rem;
  --fx-font-size-card: 1.25rem;
  --fx-font-size-page-header: 1.5rem;
  --fx-font-size-section: clamp(1.5rem, 1.25rem + 0.8vw, 2rem);
  --fx-font-size-page: clamp(2rem, 1.75rem + 1vw, 2.5rem);
  --fx-line-height-page-header: 2rem;
  --fx-line-height-tight: 1.2;
  --fx-line-height-ui: 1.4;
  --fx-line-height-body: 1.6;
  --fx-letter-spacing-tight: -0.02em;
  --fx-letter-spacing-label: 0.02em;

  /* Surfaces */
  --fx-color-canvas: #0e0c18;
  --fx-color-surface: #171429;
  --fx-color-surface-raised: #1c1633;
  --fx-color-surface-deep: #0a0812;
  --fx-color-surface-inset: #111020;
  --fx-color-sidebar: #111020;
  --fx-color-sidebar-edge: #121125;
  --fx-color-surface-hover: #211a3a;
  --fx-color-surface-selected: #2a1d4d;
  --fx-color-table-header: #24203d;
  --fx-color-message-participant: #25203f;
  --fx-color-overlay: rgba(5, 4, 12, 0.78);

  /* Text */
  --fx-color-text: #f3f4f6;
  --fx-color-text-body: #d8d6df;
  --fx-color-text-muted: #a3a1b1;
  --fx-color-text-subtle: #858198;
  --fx-color-text-disabled: #858198;
  --fx-color-text-on-primary: #ffffff;
  --fx-color-text-link: #c4b5fd;
  --fx-color-text-link-hover: #ddd6fe;

  /* Borders */
  --fx-color-border-subtle: rgba(243, 244, 246, 0.12);
  --fx-color-border: #3a3450;
  --fx-color-border-strong: #69637b;
  --fx-color-divider: rgba(243, 244, 246, 0.08);

  /* Brand and interaction */
  --fx-color-primary: #7c3aed;
  --fx-color-primary-hover: #6d28d9;
  --fx-color-primary-pressed: #5b21b6;
  --fx-color-primary-soft: rgba(124, 58, 237, 0.16);
  --fx-color-primary-soft-hover: rgba(124, 58, 237, 0.24);
  --fx-color-primary-border: rgba(167, 139, 250, 0.42);
  --fx-color-accent: #a78bfa;
  --fx-color-focus: #c4b5fd;

  /* Semantic colors: foreground values are approved on all dark surfaces. */
  --fx-color-success: #22c55e;
  --fx-color-success-fg: #86efac;
  --fx-color-success-bg: rgba(34, 197, 94, 0.1);
  --fx-color-success-border: rgba(134, 239, 172, 0.34);
  --fx-color-warning: #f59e0b;
  --fx-color-warning-fg: #fcd34d;
  --fx-color-warning-bg: rgba(245, 158, 11, 0.1);
  --fx-color-warning-border: rgba(252, 211, 77, 0.34);
  --fx-color-weak: #f97316;
  --fx-color-weak-fg: #fdba74;
  --fx-color-weak-bg: rgba(249, 115, 22, 0.1);
  --fx-color-weak-border: rgba(253, 186, 116, 0.34);
  --fx-color-danger: #ef4444;
  --fx-color-danger-hover: #dc2626;
  --fx-color-danger-pressed: #b91c1c;
  --fx-color-danger-strong: #991b1b;
  --fx-color-danger-fg: #fca5a5;
  --fx-color-danger-bg: rgba(239, 68, 68, 0.1);
  --fx-color-danger-border: rgba(252, 165, 165, 0.36);
  --fx-color-info: #38bdf8;
  --fx-color-info-fg: #7dd3fc;
  --fx-color-info-bg: rgba(56, 189, 248, 0.1);
  --fx-color-info-border: rgba(125, 211, 252, 0.34);

  /* Product preview: WhatsApp device */
  --fx-phone-color-canvas: #0b141a;
  --fx-phone-color-surface: #202c33;
  --fx-phone-color-surface-raised: #2a3942;
  --fx-phone-color-text: #ffffff;
  --fx-phone-color-muted: #8696a0;
  --fx-phone-color-brand: #00a884;
  --fx-phone-color-link: #53bdeb;

  /* Data visualization */
  --fx-chart-1: #ddd6fe;
  --fx-chart-2: #c4b5fd;
  --fx-chart-3: #a78bfa;
  --fx-chart-4: #8b5cf6;
  --fx-chart-5: #7c3aed;
  --fx-chart-6: #38bdf8;
  --fx-chart-7: #22c55e;
  --fx-chart-8: #f59e0b;
  --fx-chart-grid: rgba(243, 244, 246, 0.1);
  --fx-chart-axis: #a3a1b1;
  --fx-chart-track: rgba(243, 244, 246, 0.08);

  /* Spacing */
  --fx-space-0: 0;
  --fx-space-1: 0.125rem;
  --fx-space-2: 0.25rem;
  --fx-space-3: 0.5rem;
  --fx-space-4: 0.75rem;
  --fx-space-5: 1rem;
  --fx-space-6: 1.5rem;
  --fx-space-7: 2rem;
  --fx-space-8: 3rem;
  --fx-space-9: 4rem;
  --fx-space-10: 6rem;

  /* Shape */
  --fx-radius-none: 0;
  --fx-radius-xs: 0.25rem;
  --fx-radius-control: 0.5rem;
  --fx-radius-card: 0.75rem;
  --fx-radius-overlay: 1rem;
  --fx-radius-device: 2.5rem;
  --fx-radius-pill: 9999px;

  /* Sizing */
  --fx-control-height-sm: 2.25rem;
  --fx-control-height: 2.75rem;
  --fx-control-height-lg: 3rem;
  --fx-target-min: 2.75rem;
  --fx-content-max: 77.5rem;
  --fx-page-header-min-height: 8.5rem;
  --fx-readable-max: 72ch;
  --fx-sidebar-width: 17rem;
  --fx-sidebar-collapsed-width: 5.25rem;

  /* Elevation */
  --fx-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2);
  --fx-shadow-raised: 0 12px 32px rgba(0, 0, 0, 0.34);
  --fx-shadow-overlay: 0 24px 72px rgba(0, 0, 0, 0.58);
  --fx-glow-primary: 0 0 0 1px rgba(167, 139, 250, 0.1), 0 16px 48px rgba(124, 58, 237, 0.14);

  /* Focus */
  --fx-focus-width: 0.125rem;
  --fx-focus-offset: 0.125rem;
  --fx-focus-ring: 0 0 0 var(--fx-focus-offset) var(--fx-color-canvas), 0 0 0 calc(var(--fx-focus-offset) + var(--fx-focus-width)) var(--fx-color-focus);

  /* Motion */
  --fx-duration-instant: 1ms;
  --fx-duration-fast: 140ms;
  --fx-duration-base: 220ms;
  --fx-duration-slow: 300ms;
  --fx-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fx-ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --fx-ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* Layers */
  --fx-z-base: 0;
  --fx-z-sticky: 10;
  --fx-z-dropdown: 20;
  --fx-z-overlay: 30;
  --fx-z-dialog: 40;
  --fx-z-toast: 50;

  /* Scrollbar */
  --fx-scrollbar-size: 0.5rem;
  --fx-scrollbar-size-compact: 0.375rem;
  --fx-scrollbar-track: rgba(243, 244, 246, 0.055);
  --fx-scrollbar-thumb: #6d5aa0;
  --fx-scrollbar-thumb-hover: #8b73cc;
  --fx-scrollbar-thumb-active: #a78bfa;

  /* Temporary legacy aliases. These do not style anything by themselves. */
  --fx-legacy-bg: var(--fx-color-canvas);
  --fx-legacy-panel: var(--fx-color-surface);
  --fx-legacy-panel-elev: var(--fx-color-surface-raised);
  --fx-legacy-text: var(--fx-color-text);
  --fx-legacy-muted: var(--fx-color-text-muted);
  --fx-legacy-accent: var(--fx-color-primary);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --fx-duration-fast: var(--fx-duration-instant);
    --fx-duration-base: var(--fx-duration-instant);
    --fx-duration-slow: var(--fx-duration-instant);
  }
}

@media (forced-colors: active) {
  :root {
    --fx-color-border: CanvasText;
    --fx-color-border-strong: CanvasText;
    --fx-color-focus: Highlight;
  }
}
