/* ============================================================
   Perfect Employee — Design Token System
   Sovereign AI Platform
   3-Layer Architecture: Primitive → Semantic → Component
   ============================================================ */

/* --------------------------------------------------------
   LAYER 1: PRIMITIVE TOKENS (raw values, never used directly)
   -------------------------------------------------------- */

/* -- Color Primitives (HSL for opacity control) -- */
:root {
  /* Navy/Dark scale */
  --hue-navy: 218;
  --color-navy-950: hsl(var(--hue-navy), 45%, 5%);   /* #0a0e17 */
  --color-navy-900: hsl(var(--hue-navy), 40%, 9%);   /* #0f1a2e */
  --color-navy-800: hsl(var(--hue-navy), 38%, 14%);  /* #162033 */
  --color-navy-700: hsl(var(--hue-navy), 35%, 19%);  /* #1a2744 */
  --color-navy-600: hsl(var(--hue-navy), 30%, 27%);
  --color-navy-500: hsl(var(--hue-navy), 25%, 36%);

  /* Emerald/Green scale */
  --hue-emerald: 160;
  --color-emerald-500: hsl(var(--hue-emerald), 84%, 40%);  /* #10b981 */
  --color-emerald-400: hsl(var(--hue-emerald), 84%, 45%);
  --color-emerald-600: hsl(var(--hue-emerald), 84%, 32%);  /* hover */
  --color-emerald-700: hsl(var(--hue-emerald), 80%, 26%);
  --color-emerald-900: hsl(var(--hue-emerald), 70%, 12%);

  /* Blue scale */
  --hue-blue: 217;
  --color-blue-500: hsl(var(--hue-blue), 91%, 60%);  /* #3b82f6 */
  --color-blue-400: hsl(var(--hue-blue), 91%, 68%);
  --color-blue-600: hsl(var(--hue-blue), 80%, 48%);

  /* Neutral warm grays for text */
  --hue-neutral: 215;
  --color-neutral-50:  hsl(var(--hue-neutral), 25%, 96%);  /* #f1f5f9 */
  --color-neutral-200: hsl(var(--hue-neutral), 16%, 82%);
  --color-neutral-300: hsl(var(--hue-neutral), 13%, 65%);  /* #94a3b8 */
  --color-neutral-400: hsl(var(--hue-neutral), 12%, 52%);
  --color-neutral-500: hsl(var(--hue-neutral), 14%, 42%);  /* #64748b */
  --color-neutral-700: hsl(var(--hue-neutral), 14%, 27%);

  /* Functional colors */
  --color-red-500: hsl(0, 84%, 60%);     /* #ef4444 */
  --color-red-400: hsl(0, 84%, 68%);
  --color-red-900: hsl(0, 70%, 15%);
  --color-amber-500: hsl(38, 92%, 50%);  /* #f59e0b */
  --color-amber-400: hsl(38, 92%, 58%);
  --color-amber-900: hsl(38, 70%, 15%);

  /* -- Spacing Scale (4px base) -- */
  --space-0:    0;
  --space-1:    4px;
  --space-2:    8px;
  --space-3:    12px;
  --space-4:    16px;
  --space-5:    20px;
  --space-6:    24px;
  --space-8:    32px;
  --space-10:   40px;
  --space-12:   48px;
  --space-16:   64px;
  --space-20:   80px;
  --space-24:   96px;

  /* -- Typography Scale (1.25 ratio) -- */
  --text-xs:     0.75rem;    /* 12px */
  --text-sm:     0.875rem;   /* 14px */
  --text-base:   1rem;       /* 16px */
  --text-lg:     1.125rem;   /* 18px */
  --text-xl:     1.25rem;    /* 20px */
  --text-2xl:    1.5rem;     /* 24px */
  --text-3xl:    1.875rem;   /* 30px */
  --text-4xl:    2.25rem;    /* 36px */
  --text-5xl:    3rem;       /* 48px */
  --text-6xl:    3.75rem;    /* 60px */

  /* -- Font Families -- */
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  /* -- Font Weights -- */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* -- Line Heights -- */
  --leading-tight:  1.15;
  --leading-snug:   1.35;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* -- Border Radius Scale -- */
  --radius-none:   0;
  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;
  --radius-xl:     16px;
  --radius-2xl:    24px;
  --radius-full:   9999px;

  /* -- Elevation / Shadow Tokens -- */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg:  0 8px 30px rgba(0, 0, 0, 0.6);
  --shadow-xl:  0 16px 50px rgba(0, 0, 0, 0.7);
  --shadow-glow-emerald: 0 0 30px rgba(16, 185, 129, 0.15);
  --shadow-glow-blue:    0 0 30px rgba(59, 130, 246, 0.12);

  /* -- Transition Tokens -- */
  --transition-fast:    150ms ease;
  --transition-base:    250ms ease;
  --transition-slow:    400ms ease;
  --transition-spring:  500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* -- Z-Index Scale -- */
  --z-base:     0;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
}

/* --------------------------------------------------------
   LAYER 2: SEMANTIC TOKENS (purpose-based aliases)
   -------------------------------------------------------- */

:root {
  /* -- Background Semantic Tokens -- */
  --bg-primary:       var(--color-navy-950);
  --bg-secondary:     var(--color-navy-900);
  --bg-tertiary:      var(--color-navy-800);
  --bg-surface:       var(--color-navy-700);
  --bg-elevated:      hsl(var(--hue-navy), 38%, 17%);
  --bg-glass:         hsla(var(--hue-navy), 40%, 12%, 0.65);
  --bg-glass-strong:  hsla(var(--hue-navy), 40%, 14%, 0.85);

  /* -- Text Semantic Tokens -- */
  --text-primary:     var(--color-neutral-50);
  --text-secondary:   var(--color-neutral-300);
  --text-muted:       var(--color-neutral-500);
  --text-inverse:     var(--color-navy-950);
  --text-on-accent:   hsl(var(--hue-emerald), 30%, 8%);

  /* -- Accent Semantic Tokens -- */
  --accent-primary:       var(--color-emerald-500);
  --accent-primary-hover: var(--color-emerald-600);
  --accent-primary-glow:  hsla(var(--hue-emerald), 84%, 40%, 0.15);
  --accent-secondary:     var(--color-blue-500);
  --accent-secondary-hover: var(--color-blue-600);

  /* -- Status Semantic Tokens -- */
  --status-success:   var(--color-emerald-500);
  --status-warning:   var(--color-amber-500);
  --status-danger:    var(--color-red-500);
  --status-info:      var(--color-blue-500);

  --status-success-bg:  hsla(var(--hue-emerald), 84%, 40%, 0.1);
  --status-warning-bg:  hsla(38, 92%, 50%, 0.1);
  --status-danger-bg:   hsla(0, 84%, 60%, 0.1);
  --status-info-bg:     hsla(var(--hue-blue), 91%, 60%, 0.1);

  /* -- Border Semantic Tokens -- */
  --border-subtle:    hsla(0, 0%, 100%, 0.06);
  --border-default:   hsla(0, 0%, 100%, 0.08);
  --border-strong:    hsla(0, 0%, 100%, 0.12);
  --border-accent:    hsla(var(--hue-emerald), 84%, 40%, 0.3);
  --border-accent-strong: hsla(var(--hue-emerald), 84%, 40%, 0.5);

  /* -- Section Semantic Tokens -- */
  --section-padding-y:   var(--space-20);
  --section-padding-x:   var(--space-6);
  --content-max-width:   1200px;
  --content-narrow:      800px;
}

/* --------------------------------------------------------
   LAYER 3: COMPONENT TOKENS (component-specific)
   -------------------------------------------------------- */

:root {
  /* -- Button: Primary -- */
  --btn-primary-bg:           var(--accent-primary);
  --btn-primary-text:         var(--text-on-accent);
  --btn-primary-bg-hover:     var(--accent-primary-hover);
  --btn-primary-shadow:       var(--shadow-glow-emerald);

  /* -- Button: Secondary / Outline -- */
  --btn-outline-border:       var(--border-accent);
  --btn-outline-text:         var(--accent-primary);
  --btn-outline-border-hover: var(--border-accent-strong);
  --btn-outline-bg-hover:     var(--accent-primary-glow);

  /* -- Button: Ghost -- */
  --btn-ghost-text:           var(--text-secondary);
  --btn-ghost-text-hover:     var(--text-primary);
  --btn-ghost-bg-hover:       hsla(0, 0%, 100%, 0.05);

  /* -- Button Sizes -- */
  --btn-sm-py:    var(--space-2);
  --btn-sm-px:    var(--space-4);
  --btn-sm-font:  var(--text-sm);
  --btn-md-py:    var(--space-3);
  --btn-md-px:    var(--space-6);
  --btn-md-font:  var(--text-base);
  --btn-lg-py:    var(--space-4);
  --btn-lg-px:    var(--space-8);
  --btn-lg-font:  var(--text-lg);

  /* -- Card -- */
  --card-bg:          var(--bg-glass);
  --card-bg-hover:    var(--bg-glass-strong);
  --card-border:      var(--border-default);
  --card-border-hover: var(--border-strong);
  --card-padding:     var(--space-6);
  --card-radius:      var(--radius-xl);
  --card-shadow:      var(--shadow-sm);
  --card-shadow-hover: var(--shadow-md);

  /* -- Input / Form -- */
  --input-bg:         var(--bg-tertiary);
  --input-border:     var(--border-default);
  --input-border-focus: var(--border-accent);
  --input-text:       var(--text-primary);
  --input-placeholder: var(--text-muted);
  --input-radius:     var(--radius-md);
  --input-padding-y:  var(--space-3);
  --input-padding-x:  var(--space-4);

  /* -- Badge / Pill -- */
  --badge-bg:         hsla(0, 0%, 100%, 0.06);
  --badge-text:       var(--text-secondary);
  --badge-radius:     var(--radius-full);
  --badge-padding-y:  var(--space-1);
  --badge-padding-x:  var(--space-3);

  /* -- Navbar -- */
  --navbar-bg:        hsla(var(--hue-navy), 45%, 5%, 0.85);
  --navbar-height:    72px;
  --navbar-blur:      16px;

  /* -- Dashboard -- */
  --dash-sidebar-width:   220px;
  --dash-detail-width:    360px;
  --dash-topbar-height:   56px;
  --dash-bg:              var(--color-navy-950);
  --dash-panel-bg:        hsl(var(--hue-navy), 42%, 7%);
  --dash-border:          var(--border-subtle);
}

/* --------------------------------------------------------
   CSS RESET + GLOBAL BASE
   -------------------------------------------------------- */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* Focus ring — accessible but subtle */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: hsla(var(--hue-emerald), 84%, 40%, 0.3);
  color: var(--text-primary);
}

/* --------------------------------------------------------
   UTILITY CLASSES
   -------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding-inline: var(--section-padding-x);
}

.container-narrow {
  max-width: var(--content-narrow);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Glass utility */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
}

.glass-strong {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
}

/* Section spacing */
.section {
  padding: var(--section-padding-y) var(--section-padding-x);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border-default);
  border: none;
}

/* --------------------------------------------------------
   ANIMATION UTILITIES
   -------------------------------------------------------- */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-primary-glow); }
  50%      { box-shadow: 0 0 40px hsla(var(--hue-emerald), 84%, 40%, 0.25); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-12px); }
}

@keyframes count-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.7s ease forwards;
}

/* Scroll-triggered (applied via Intersection Observer) */
.scroll-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

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