/* ==========================================================================
   WORKWAY Design Tokens - CDN Distribution
   "Weniger, aber besser" - Dieter Rams

   Usage: <link rel="stylesheet" href="https://cdn.workway.co/tokens.css">

   This file serves as the canonical source of truth for WORKWAY design tokens.
   All Private/BYOO Workflows should use these tokens for consistency.
   ========================================================================== */

:root {
  /* ==========================================================================
     Background Colors - Pure to near-black
     ========================================================================== */
  --color-bg-pure: #000000;
  --color-bg-elevated: #0a0a0a;
  --color-bg-surface: #111111;
  --color-bg-subtle: #1a1a1a;

  /* ==========================================================================
     Foreground Colors - White with semantic opacity
     ========================================================================== */
  --color-fg-primary: #ffffff;
  --color-fg-secondary: rgba(255, 255, 255, 0.8);
  --color-fg-tertiary: rgba(255, 255, 255, 0.6);
  --color-fg-muted: rgba(255, 255, 255, 0.4);
  --color-fg-subtle: rgba(255, 255, 255, 0.2);

  /* ==========================================================================
     Border Colors - Subtle separation
     ========================================================================== */
  --color-border-default: rgba(255, 255, 255, 0.1);
  --color-border-emphasis: rgba(255, 255, 255, 0.2);
  --color-border-strong: rgba(255, 255, 255, 0.3);

  /* ==========================================================================
     Functional Colors - Muted, purposeful
     ========================================================================== */
  --color-success: #44aa44;
  --color-success-muted: rgba(68, 170, 68, 0.2);
  --color-error: #cc4444;
  --color-error-muted: rgba(204, 68, 68, 0.2);
  --color-warning: #aa8844;
  --color-warning-muted: rgba(170, 136, 68, 0.2);
  --color-info: #4477aa;
  --color-info-muted: rgba(68, 119, 170, 0.2);

  /* ==========================================================================
     Interactive States
     ========================================================================== */
  --color-hover: rgba(255, 255, 255, 0.05);
  --color-active: rgba(255, 255, 255, 0.1);
  --color-focus: rgba(255, 255, 255, 0.2);

  /* ==========================================================================
     Shadow System - Elevation and hierarchy
     ========================================================================== */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow-sm: 0 0 10px rgba(255, 255, 255, 0.05);
  --shadow-glow-md: 0 0 20px rgba(255, 255, 255, 0.1);

  /* ==========================================================================
     Radius System
     ========================================================================== */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ==========================================================================
     Animation System - "Good design is unobtrusive"
     ========================================================================== */
  --ease-standard: cubic-bezier(0.4, 0.0, 0.2, 1);
  --duration-micro: 200ms;
  --duration-standard: 300ms;
  --duration-complex: 500ms;

  /* ==========================================================================
     Typography System
     ========================================================================== */
  --font-sans: 'Stack Sans Notch', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', monospace;

  /* Font weights */
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Letter spacing */
  --tracking-tighter: -0.025em;
  --tracking-tight: -0.015em;
  --tracking-normal: 0;

  /* Fluid type scale */
  --text-display-xl: clamp(3.5rem, 5vw + 2rem, 7rem);
  --text-display: clamp(2.5rem, 4vw + 1.5rem, 5rem);
  --text-h1: clamp(2rem, 3vw + 1rem, 3.5rem);
  --text-h2: clamp(1.5rem, 2vw + 0.75rem, 2.25rem);
  --text-h3: clamp(1.25rem, 1.5vw + 0.5rem, 1.75rem);
  --text-h4: clamp(1.125rem, 1vw + 0.5rem, 1.5rem);
  --text-body-lg: 1.125rem;
  --text-body: 1rem;
  --text-body-sm: 0.875rem;
  --text-caption: 0.75rem;

  /* ==========================================================================
     Golden Ratio Spacing Scale (phi = 1.618)
     ========================================================================== */
  --space-xs: 0.5rem;      /* 8px */
  --space-sm: 1rem;        /* 16px - base unit */
  --space-md: 1.618rem;    /* ~26px */
  --space-lg: 2.618rem;    /* ~42px */
  --space-xl: 4.236rem;    /* ~68px */
  --space-2xl: 6.854rem;   /* ~110px */

  /* ==========================================================================
     Short Aliases - Backwards compatibility for existing workflows
     Usage: var(--bg-pure) instead of var(--color-bg-pure)
     ========================================================================== */
  --bg-pure: var(--color-bg-pure);
  --bg-elevated: var(--color-bg-elevated);
  --bg-surface: var(--color-bg-surface);
  --bg-subtle: var(--color-bg-subtle);
  --fg-primary: var(--color-fg-primary);
  --fg-secondary: var(--color-fg-secondary);
  --fg-tertiary: var(--color-fg-tertiary);
  --fg-muted: var(--color-fg-muted);
  --fg-subtle: var(--color-fg-subtle);
  --border-default: var(--color-border-default);
  --border-emphasis: var(--color-border-emphasis);
  --border-strong: var(--color-border-strong);
  --success: var(--color-success);
  --success-muted: var(--color-success-muted);
  --error: var(--color-error);
  --error-muted: var(--color-error-muted);
  --warning: var(--color-warning);
  --warning-muted: var(--color-warning-muted);
  --info: var(--color-info);
  --info-muted: var(--color-info-muted);
}

/* ==========================================================================
   Base Styles - Applied automatically
   ========================================================================== */
body {
  margin: 0;
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: var(--tracking-tight);
  background-color: var(--color-bg-pure);
  color: var(--color-fg-primary);
  line-height: var(--leading-normal);
}

/* Focus states for accessibility */
*:focus-visible {
  outline: 2px solid var(--color-border-emphasis);
  outline-offset: 2px;
}

/* Link styles */
a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--duration-micro) var(--ease-standard);
}

a:hover {
  opacity: 0.7;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
