/* ============================================
   AI-ERP Base Stylesheet
   Reset + Design Tokens + Foundation
   ============================================ */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: auto; /* Lenis handles smooth scroll */
  font-size: 16px;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

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

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* --- Design Tokens --- */
:root {
  /* Colors - Dark Premium */
  --color-bg: #0a0a0f;
  --color-bg-elevated: #111118;
  --color-surface: rgba(255, 255, 255, 0.04);
  --color-surface-hover: rgba(255, 255, 255, 0.07);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(255, 255, 255, 0.15);

  /* Text */
  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.65);
  --color-text-faint: rgba(255, 255, 255, 0.38);

  /* Brand Colors */
  --color-gold: #C9A86C;
  --color-gold-bright: #D4AF37;
  --color-gold-dim: rgba(201, 168, 108, 0.15);
  --color-purple: #6366F1;
  --color-purple-hover: #7577F5;
  --color-purple-dim: rgba(99, 102, 241, 0.15);

  /* Semantic */
  --color-success: #34D399;
  --color-error: #F87171;

  /* Typography */
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  --font-chinese: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-thai: 'Noto Sans Thai', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Type Scale (fluid) */
  --text-xs: clamp(0.6875rem, 0.65rem + 0.1vw, 0.75rem);    /* 11-12px */
  --text-sm: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);   /* 13-14px */
  --text-base: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);      /* 15-16px */
  --text-lg: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem);       /* 17-18px */
  --text-xl: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);         /* 20-24px */
  --text-2xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);             /* 24-32px */
  --text-3xl: clamp(2rem, 1.5rem + 1.8vw, 3rem);             /* 32-48px */
  --text-hero: clamp(2.5rem, 1.8rem + 2.5vw, 4rem);          /* 40-64px */

  /* Spacing (4px grid) */
  --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-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  --space-32: 8rem;     /* 128px */

  /* Layout */
  --max-width: 1200px;
  --max-width-wide: 1400px;
  --content-padding: clamp(var(--space-4), 5vw, var(--space-8));

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 30px rgba(201, 168, 108, 0.15);
  --shadow-purple: 0 0 30px rgba(99, 102, 241, 0.2);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --transition-fast: 180ms var(--ease-out);
  --transition-normal: 300ms var(--ease-out);
  --transition-slow: 500ms var(--ease-out);

  /* Z-index */
  --z-nav: 100;
  --z-overlay: 200;
  --z-modal: 300;
}

/* --- Base Elements --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

p {
  line-height: 1.7;
  color: var(--color-text-muted);
}

::selection {
  background: rgba(201, 168, 108, 0.3);
  color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Focus visible --- */
:focus-visible {
  outline: 2px solid var(--color-purple);
  outline-offset: 2px;
}

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

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--content-padding);
}

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