/*
 * TESSARAKT Fund Management System
 * Phase 1 — Design Foundation
 *
 * This file contains presentation tokens only. It intentionally does not
 * style application components or replace legacy variables. Semantic color
 * tokens reference the active legacy theme variables so existing dark/light
 * theme behavior remains unchanged while new UI work gains a stable contract.
 */

:root {
  /* Typography */
  --font-family-sans: Inter, "Segoe UI", Arial, sans-serif;
  --font-family-mono: Consolas, "SFMono-Regular", "Liberation Mono", monospace;

  --font-size-2xs: 0.625rem;  /* 10px */
  --font-size-xs: 0.6875rem; /* 11px */
  --font-size-sm: 0.75rem;   /* 12px */
  --font-size-md: 0.8125rem; /* 13px */
  --font-size-base: 0.875rem;/* 14px */
  --font-size-lg: 1rem;      /* 16px */
  --font-size-xl: 1.125rem;  /* 18px */
  --font-size-2xl: 1.375rem; /* 22px */
  --font-size-3xl: 1.75rem;  /* 28px */
  --font-size-4xl: 2.125rem; /* 34px */
  --font-size-kpi: clamp(1.75rem, 2.4vw, 2.5rem);
  --font-size-page-title: clamp(1.75rem, 2.4vw, 2.125rem);

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --font-weight-black: 900;

  --line-height-none: 1;
  --line-height-tight: 1.2;
  --line-height-snug: 1.35;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.65;

  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0;
  --letter-spacing-label: 0.08em;
  --letter-spacing-brand: 0.14em;

  /* Eight-point spacing system with four-pixel half steps */
  --space-0: 0;
  --space-0-5: 0.125rem; /* 2px */
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-7: 2rem;       /* 32px */
  --space-8: 2.5rem;     /* 40px */
  --space-9: 3rem;       /* 48px */
  --space-10: 4rem;      /* 64px */

  /* Radius */
  --radius-none: 0;
  --radius-xs: 0.375rem; /* 6px */
  --radius-sm: 0.5rem;   /* 8px */
  --radius-md: 0.75rem;  /* 12px */
  --radius-lg: 1rem;     /* 16px */
  --radius-xl: 1.25rem;  /* 20px */
  --radius-2xl: 1.5rem;  /* 24px */
  --radius-pill: 999px;

  /* Elevation */
  --shadow-none: none;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.24);
  --shadow-xl: 0 22px 52px rgba(0, 0, 0, 0.32);
  --shadow-overlay: 0 28px 80px rgba(0, 0, 0, 0.46);

  /* Control and application sizing */
  --size-control-sm: 2rem;      /* 32px */
  --size-control-md: 2.5rem;    /* 40px */
  --size-control-lg: 3rem;      /* 48px */
  --size-icon-sm: 1rem;         /* 16px */
  --size-icon-md: 1.25rem;      /* 20px */
  --size-icon-lg: 1.5rem;       /* 24px */
  --size-avatar-sm: 1.5rem;     /* 24px */
  --size-avatar-md: 2rem;       /* 32px */
  --size-avatar-lg: 2.75rem;    /* 44px */
  --size-table-row: 3.25rem;    /* 52px */
  --size-table-row-comfortable: 4rem; /* 64px */
  --size-header: 4.5rem;        /* 72px */
  --size-sidebar-expanded: 18rem;    /* 288px */
  --size-sidebar-collapsed: 4.75rem; /* 76px */
  --size-content-max: 100rem;   /* 1600px */
  --size-modal-sm: 30rem;       /* 480px */
  --size-modal-md: 45rem;       /* 720px */
  --size-modal-lg: 60rem;       /* 960px */
  --size-modal-xl: 90rem;       /* 1440px */

  /* Motion */
  --duration-instant: 80ms;
  --duration-fast: 160ms;
  --duration-normal: 240ms;
  --duration-slow: 360ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1.2);
  --opacity-disabled: 0.55;
  --opacity-muted: 0.72;

  /* Layering */
  --z-base: 0;
  --z-sticky: 10;
  --z-header: 30;
  --z-dropdown: 100;
  --z-popover: 200;
  --z-overlay: 500;
  --z-modal: 600;
  --z-toast: 1000;

  /*
   * Semantic colors.
   * These aliases deliberately resolve against the existing active theme.
   * They do not change the current palette.
   */
  --color-bg-app: var(--bg);
  --color-bg-surface: var(--card, var(--panel));
  --color-bg-surface-subtle: var(--card-2, var(--panel-2));
  --color-bg-surface-elevated: var(--panel-3, var(--card));
  --color-bg-input: var(--bg);
  --color-bg-overlay: rgba(0, 0, 0, 0.68);
  --color-bg-hover: rgba(72, 165, 255, 0.08);
  --color-bg-selected: rgba(72, 165, 255, 0.14);

  --color-text-primary: var(--text);
  --color-text-secondary: var(--secondary, var(--muted));
  --color-text-muted: var(--muted, var(--secondary));
  --color-text-inverse: #ffffff;

  --color-border-default: var(--border, var(--line));
  --color-border-strong: rgba(141, 154, 176, 0.3);
  --color-border-subtle: rgba(141, 154, 176, 0.12);

  --color-action-primary: var(--accent, var(--blue));
  --color-action-primary-hover: var(--blue, var(--accent));
  --color-action-primary-text: #ffffff;
  --color-action-secondary: var(--color-bg-surface-subtle);
  --color-action-secondary-hover: var(--color-bg-hover);
  --color-focus-ring: rgba(72, 165, 255, 0.42);

  --color-success: var(--success, var(--green));
  --color-warning: var(--warning, var(--amber));
  --color-danger: var(--danger, var(--red));
  --color-info: var(--blue, var(--accent));
  --color-accent: var(--purple);

  /* Financial/data visualization aliases */
  --color-value-positive: var(--success, var(--green));
  --color-value-negative: var(--danger, var(--red));
  --color-value-neutral: var(--blue, var(--accent));
  --color-value-accent: var(--purple);

  /* Component-level foundation aliases */
  --button-height: var(--size-control-md);
  --button-radius: var(--radius-md);
  --input-height: var(--size-control-md);
  --input-radius: var(--radius-md);
  --card-radius: var(--radius-xl);
  --card-padding: var(--space-6);
  --card-shadow: var(--shadow-lg);
  --table-row-height: var(--size-table-row);
  --table-cell-padding-x: var(--space-4);
  --table-cell-padding-y: var(--space-3);
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
}

/*
 * Required desktop validation widths:
 * compact desktop: 1366×768
 * standard desktop: 1536×864
 * large laptop:    1600×900
 * wide desktop:    1920×1080
 *
 * Standard implementation breakpoints for future component work:
 * compact: <= 1280px
 * standard: 1281px–1440px
 * large: 1441px–1680px
 * wide: >= 1681px
 */

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