/*
 * e-Building UI Design System
 * Design Tokens v1.0
 *
 * Canonical visual tokens for new and progressively migrated UI.
 *
 * Design principles:
 * - Evolution, not redesign
 * - Calm Density
 * - Semantic tokens over arbitrary values
 * - Desktop + tablet + mobile by design
 * - Accessibility baseline: WCAG 2.2 AA
 *
 * IMPORTANT
 * -----------------------------------------------------------
 * This file defines tokens only.
 * It MUST NOT style application components or legacy pages.
 *
 * Loading this file alone must not visually modify the product.
 *
 * Components should consume SEMANTIC TOKENS rather than
 * primitive color values whenever possible.
 */

/* ============================================================
   1. PRIMITIVES — BRAND

   Historical e-Building identity primitives.

   Brand colors are NOT automatically interaction or semantic
   colors. Their presence here preserves brand identity without
   forcing them into every application control.
   ============================================================ */

:root {
  --eb-brand-red: #fb0000;
  --eb-brand-red-strong: #db0000;
  --eb-brand-red-deep: #b70000;

  --eb-brand-blue: #0075ff;
  --eb-brand-blue-strong: #0062b2;
  --eb-brand-blue-deep: #004a93;

  --eb-brand-ink: #151515;
  --eb-brand-paper: #f3f3f3;

  /* ==========================================================
     2. PRIMITIVES — NEUTRALS

     Neutral scale for text, surfaces, borders and structure.
     ========================================================== */

  --eb-neutral-0: #ffffff;
  --eb-neutral-25: #fcfdff;
  --eb-neutral-50: #f8fafc;
  --eb-neutral-100: #f1f5f9;
  --eb-neutral-200: #e2e8f0;
  --eb-neutral-300: #cbd5e1;
  --eb-neutral-400: #94a3b8;
  --eb-neutral-500: #64748b;
  --eb-neutral-600: #475569;
  --eb-neutral-700: #334155;
  --eb-neutral-800: #1e293b;
  --eb-neutral-900: #0f172a;
  --eb-neutral-950: #0b1422;

  /* ==========================================================
     3. PRIMITIVES — INTERACTION BLUE

     Evolves the existing e-Building / e-Drive interaction
     language into a coherent scale.

     700+ is preferred when blue contains normal-size white
     text and WCAG AA contrast is required.
     ========================================================== */

  --eb-blue-50: #f0f9ff;
  --eb-blue-100: #e0f2fe;
  --eb-blue-200: #bae6fd;
  --eb-blue-300: #7dd3fc;
  --eb-blue-400: #38bdf8;
  --eb-blue-500: #0ea5e9;
  --eb-blue-600: #0284c7;
  --eb-blue-700: #0369a1;
  --eb-blue-800: #075985;
  --eb-blue-900: #0c4a6e;
  --eb-blue-950: #082f49;

  /* ==========================================================
     4. SHELL

     Preserves and rationalizes the existing dark e-Building
     navigation language.
     ========================================================== */

  --eb-shell-bg: #0f1b2f;
  --eb-shell-bg-elevated: #13233a;
  --eb-shell-bg-hover: #1b2e49;
  --eb-shell-bg-active: #203b5c;

  --eb-shell-border: #243247;

  --eb-shell-text: #e7eefc;
  --eb-shell-text-secondary: #cbd5e1;
  --eb-shell-text-muted: #94a3b8;

  /* ==========================================================
     5. SEMANTIC — APPLICATION SURFACES
     ========================================================== */

  --eb-color-bg-app: #f6f8fb;
  --eb-color-bg-surface: var(--eb-neutral-0);
  --eb-color-bg-surface-raised: var(--eb-neutral-0);
  --eb-color-bg-subtle: var(--eb-neutral-50);
  --eb-color-bg-muted: var(--eb-neutral-100);

  --eb-color-bg-hover: var(--eb-neutral-50);
  --eb-color-bg-selected: var(--eb-blue-100);
  --eb-color-bg-disabled: var(--eb-neutral-100);

  --eb-color-backdrop: rgba(2, 6, 23, 0.48);

  /* ==========================================================
     6. SEMANTIC — TEXT

     Disabled text is intentionally visually de-emphasized.
     It must never be used for active instructional or
     informational content.
     ========================================================== */

  --eb-color-text-primary: var(--eb-neutral-950);
  --eb-color-text-secondary: var(--eb-neutral-600);
  --eb-color-text-muted: #5a6a7a;
  --eb-color-text-placeholder: var(--eb-neutral-500);
  --eb-color-text-disabled: var(--eb-neutral-400);
  --eb-color-text-inverse: var(--eb-neutral-0);

  /* ==========================================================
     7. SEMANTIC — BORDERS / SEPARATORS
     ========================================================== */

  --eb-color-border-subtle: #dce4ee;
  --eb-color-border-default: var(--eb-neutral-300);
  --eb-color-border-strong: var(--eb-neutral-400);

  /*
   * Functional control boundaries are intentionally stronger
   * than decorative card/divider borders.
   */
  --eb-color-border-control: var(--eb-neutral-500);
  --eb-color-border-control-hover: var(--eb-neutral-600);

  --eb-color-divider: var(--eb-neutral-200);

  --eb-border-width-default: 1px;
  --eb-border-width-strong: 2px;

  /* ==========================================================
     8. SEMANTIC — INTERACTION

     Blue is the principal functional interaction language.

     The primary action uses an AA-compatible dark blue rather
     than the brighter decorative accent.
     ========================================================== */

  --eb-color-interactive: var(--eb-blue-700);
  --eb-color-interactive-hover: var(--eb-blue-800);
  --eb-color-interactive-active: var(--eb-blue-900);

  --eb-color-link: var(--eb-blue-700);
  --eb-color-link-hover: var(--eb-blue-800);

  --eb-color-selection-bg: var(--eb-blue-100);
  --eb-color-selection-text: var(--eb-blue-900);
  --eb-color-selection-border: var(--eb-blue-600);

  /* Primary action */

  --eb-color-action-primary-bg: var(--eb-blue-700);
  --eb-color-action-primary-hover-bg: var(--eb-blue-800);
  --eb-color-action-primary-active-bg: var(--eb-blue-900);
  --eb-color-action-primary-text: var(--eb-neutral-0);

  /* Secondary / neutral action */

  --eb-color-action-secondary-bg: var(--eb-neutral-0);
  --eb-color-action-secondary-hover-bg: var(--eb-neutral-50);
  --eb-color-action-secondary-active-bg: var(--eb-neutral-100);
  --eb-color-action-secondary-text: var(--eb-neutral-800);
  --eb-color-action-secondary-border: var(--eb-neutral-300);

  /* Strong neutral action
     Useful for high-emphasis product actions such as patterns
     already successfully used in e-Drive. */

  --eb-color-action-strong-bg: var(--eb-neutral-950);
  --eb-color-action-strong-hover-bg: var(--eb-neutral-900);
  --eb-color-action-strong-active-bg: var(--eb-neutral-800);
  --eb-color-action-strong-text: var(--eb-neutral-0);

  /* Disabled action */

  --eb-color-action-disabled-bg: var(--eb-neutral-100);
  --eb-color-action-disabled-text: var(--eb-neutral-400);
  --eb-color-action-disabled-border: var(--eb-neutral-200);

  /* ==========================================================
     9. FOCUS

     Focus must remain visibly distinct from hover, active and
     selection.
     ========================================================== */

  /*
   * Light and dark surfaces intentionally use different focus
   * colors to preserve high visual contrast without changing
   * the interaction meaning.
   */
  --eb-color-focus: var(--eb-blue-700);
  --eb-color-focus-inverse: var(--eb-blue-300);

  --eb-focus-ring-width: 2px;
  --eb-focus-ring-offset: 2px;

  --eb-focus-ring-color: var(--eb-color-focus);
  --eb-focus-ring-color-inverse: var(--eb-color-focus-inverse);

  --eb-focus-shadow: 0 0 0 3px rgba(3, 105, 161, 0.2);
  --eb-focus-shadow-inverse: 0 0 0 3px rgba(125, 211, 252, 0.28);

  /* ==========================================================
     10. SEMANTIC STATES — SUCCESS
     ========================================================== */

  --eb-color-success: #047857;
  --eb-color-success-strong: #065f46;
  --eb-color-success-bg: #ecfdf5;
  --eb-color-success-border: #6ee7b7;
  --eb-color-success-text: #065f46;

  /* ==========================================================
     11. SEMANTIC STATES — WARNING
     ========================================================== */

  --eb-color-warning: #92400e;
  --eb-color-warning-strong: #78350f;
  --eb-color-warning-bg: #fffbeb;
  --eb-color-warning-border: #f59e0b;
  --eb-color-warning-text: #78350f;

  /* ==========================================================
     12. SEMANTIC STATES — DANGER

     Danger is independent from the brand red family.

     Brand identity and destructive meaning must not become
     semantically interchangeable.
     ========================================================== */

  --eb-color-danger: #b91c1c;
  --eb-color-danger-hover: #991b1b;
  --eb-color-danger-active: #7f1d1d;

  --eb-color-danger-bg: #fef2f2;
  --eb-color-danger-border: #fca5a5;
  --eb-color-danger-text: #991b1b;

  --eb-color-action-danger-bg: var(--eb-color-danger);
  --eb-color-action-danger-hover-bg: var(--eb-color-danger-hover);
  --eb-color-action-danger-active-bg: var(--eb-color-danger-active);
  --eb-color-action-danger-text: var(--eb-neutral-0);

  /* ==========================================================
     13. SEMANTIC STATES — INFO
     ========================================================== */

  --eb-color-info: var(--eb-blue-700);
  --eb-color-info-strong: var(--eb-blue-800);
  --eb-color-info-bg: var(--eb-blue-50);
  --eb-color-info-border: var(--eb-blue-300);
  --eb-color-info-text: var(--eb-blue-800);

  /* ==========================================================
     14. TYPOGRAPHY — FONT FAMILIES

     UI typography is intentionally independent from historical
     brand typography.
     ========================================================== */

  --eb-font-family-sans:
    system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Arial, sans-serif;

  --eb-font-family-mono:
    ui-monospace, 'SFMono-Regular', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;

  /* ==========================================================
     15. TYPOGRAPHY — SIZE SCALE

     rem-based to preserve browser/user scaling.
     ========================================================== */

  --eb-font-size-xs: 0.75rem; /* 12px */
  --eb-font-size-sm: 0.8125rem; /* 13px */
  --eb-font-size-md: 0.875rem; /* 14px */
  --eb-font-size-body: 0.9375rem; /* 15px */
  --eb-font-size-base: 1rem; /* 16px */
  --eb-font-size-lg: 1.125rem; /* 18px */
  --eb-font-size-xl: 1.25rem; /* 20px */
  --eb-font-size-2xl: 1.5rem; /* 24px */
  --eb-font-size-3xl: 1.875rem; /* 30px */

  /* Mobile form controls should normally render at >= 16px
     to avoid platform auto-zoom behavior. */

  --eb-font-size-control-touch: 1rem;

  /* ==========================================================
     16. TYPOGRAPHY — WEIGHT / LINE HEIGHT
     ========================================================== */

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

  --eb-line-height-tight: 1.2;
  --eb-line-height-heading: 1.3;
  --eb-line-height-normal: 1.45;
  --eb-line-height-relaxed: 1.6;

  --eb-letter-spacing-tight: -0.01em;
  --eb-letter-spacing-normal: 0;
  --eb-letter-spacing-wide: 0.02em;

  /* ==========================================================
     17. SPACING

     Base rhythm: 4px.

     Do not create a second arbitrary spacing scale inside
     application components.
     ========================================================== */

  --eb-space-0: 0;
  --eb-space-1: 0.25rem; /* 4px */
  --eb-space-2: 0.5rem; /* 8px */
  --eb-space-3: 0.75rem; /* 12px */
  --eb-space-4: 1rem; /* 16px */
  --eb-space-5: 1.25rem; /* 20px */
  --eb-space-6: 1.5rem; /* 24px */
  --eb-space-8: 2rem; /* 32px */
  --eb-space-10: 2.5rem; /* 40px */
  --eb-space-12: 3rem; /* 48px */

  /* ==========================================================
     18. DENSITY / CONTROL SIZING

     Compact desktop density plus touch-safe mobile targets.
     ========================================================== */

  --eb-control-height-compact: 2rem; /* 32px */
  --eb-control-height-default: 2.25rem; /* 36px */
  --eb-control-height-comfortable: 2.5rem; /* 40px */
  --eb-control-height-touch: 2.75rem; /* 44px */

  --eb-touch-target-min: 2.75rem; /* 44px */

  --eb-row-height-compact: 2rem;
  --eb-row-height-default: 2.5rem;
  --eb-row-height-touch: 2.75rem;

  /* ==========================================================
     19. RADIUS

     Derived from the strongest existing e-Building patterns:
     10px controls, ~14px structural surfaces, larger floating
     elements.
     ========================================================== */

  --eb-radius-none: 0;
  --eb-radius-xs: 4px;
  --eb-radius-sm: 6px;
  --eb-radius-md: 10px;
  --eb-radius-lg: 14px;
  --eb-radius-xl: 18px;
  --eb-radius-pill: 999px;

  /* ==========================================================
     20. ELEVATION

     Elevation is intentionally restrained.
     ========================================================== */

  --eb-shadow-none: none;

  --eb-shadow-surface: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);

  --eb-shadow-card: 0 2px 8px rgba(15, 23, 42, 0.06);

  --eb-shadow-floating: 0 12px 28px rgba(15, 23, 42, 0.14);

  --eb-shadow-dialog: 0 24px 64px rgba(15, 23, 42, 0.2);

  /* ==========================================================
     21. ICONOGRAPHY
     ========================================================== */

  --eb-icon-xs: 14px;
  --eb-icon-sm: 16px;
  --eb-icon-md: 20px;
  --eb-icon-lg: 24px;

  --eb-icon-stroke-default: 1.75;

  /* ==========================================================
     22. MOTION

     Motion must be fast, purposeful and optional.
     Foundation/components must also respect
     prefers-reduced-motion.
     ========================================================== */

  --eb-duration-instant: 80ms;
  --eb-duration-fast: 120ms;
  --eb-duration-normal: 180ms;
  --eb-duration-slow: 240ms;

  --eb-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --eb-ease-emphasized: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* ==========================================================
     23. RESPONSIVE REFERENCE

     Reference values for Design System governance.

     CSS custom properties cannot be relied upon directly as
     media-query conditions in the current baseline. Foundation
     media queries must therefore use the corresponding literal
     values until an approved alternative is adopted.
     ========================================================== */

  --eb-breakpoint-sm: 30rem; /* 480px */
  --eb-breakpoint-md: 48rem; /* 768px */
  --eb-breakpoint-lg: 64rem; /* 1024px */
  --eb-breakpoint-xl: 80rem; /* 1280px */
  --eb-breakpoint-2xl: 90rem; /* 1440px */

  /* ==========================================================
     24. LAYER / Z-INDEX

     Shared layers prevent page-specific z-index escalation.
     ========================================================== */

  --eb-z-base: 0;
  --eb-z-raised: 10;
  --eb-z-sticky: 100;
  --eb-z-dropdown: 400;
  --eb-z-popover: 500;
  --eb-z-overlay: 800;
  --eb-z-modal: 900;
  --eb-z-toast: 1000;
  --eb-z-tooltip: 1100;
}
