/* ============================================================
   XKSGROUP DESIGN SYSTEM
   Version 1.0 - Unified Design Tokens & Components
   ============================================================ */

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
  /* Primary Palette */
  --color-primary: #EC5B13;
  --color-primary-hover: #D94F0A;
  --color-primary-light: rgba(236, 91, 19, 0.1);
  --color-primary-medium: rgba(236, 91, 19, 0.2);
  --color-primary-glow: rgba(236, 91, 19, 0.25);

  /* Navy / Dark Palette */
  --color-navy-950: #060D1F;
  --color-navy-900: #0A1128;
  --color-navy-800: #1C2541;
  --color-navy-700: #2A3655;

  /* Surface Colors */
  --color-surface-light: #F8F6F3;
  --color-surface-white: #FFFFFF;
  --color-surface-dark: #0C0A09;
  --color-surface-dark-elevated: #1A1714;
  --color-surface-dark-card: rgba(255, 255, 255, 0.04);

  /* Text Colors */
  --color-text-primary: #0F172A;
  --color-text-secondary: #64748B;
  --color-text-tertiary: #94A3B8;
  --color-text-inverse: #F1F5F9;
  --color-text-inverse-secondary: #94A3B8;

  /* Borders */
  --color-border-light: #E2E8F0;
  --color-border-dark: rgba(255, 255, 255, 0.08);
  --color-border-dark-hover: rgba(255, 255, 255, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  --shadow-primary: 0 8px 24px rgba(236, 91, 19, 0.25);
  --shadow-dark-card: 0 4px 24px rgba(0, 0, 0, 0.3);

  /* Typography Scale */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-xs: 0.75rem;     /* 12px */
  --font-size-sm: 0.875rem;    /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;    /* 18px */
  --font-size-xl: 1.25rem;     /* 20px */
  --font-size-2xl: 1.5rem;     /* 24px */
  --font-size-3xl: 1.875rem;   /* 30px */
  --font-size-4xl: 2.25rem;    /* 36px */
  --font-size-5xl: 3rem;       /* 48px */
  --font-size-6xl: 3.75rem;    /* 60px */
  --font-size-7xl: 4.5rem;     /* 72px */

  /* Spacing Scale */
  --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 */

  /* Border Radius */
  --radius-sm: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-2xl: 1.25rem;   /* 20px */
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

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

/* ---- Light Theme Override ---- */
[data-theme="light"] {
  --color-surface-dark: #F8F6F3;
  --color-surface-dark-elevated: #FFFFFF;
  --color-surface-dark-card: rgba(0, 0, 0, 0.03);
  --color-text-inverse: #0F172A;
  --color-text-inverse-secondary: #64748B;
  --color-border-dark: rgba(0, 0, 0, 0.08);
  --color-border-dark-hover: rgba(0, 0, 0, 0.15);
  --color-navy-900: #F1F0EE;
  --color-navy-950: #E8E6E3;
  --shadow-dark-card: 0 4px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] ::selection {
  background: rgba(236, 91, 19, 0.2);
  color: #0F172A;
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: #F8F6F3;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* -- Light global component overrides -- */
[data-theme="light"] .btn--ghost {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text-inverse);
  border-color: rgba(0, 0, 0, 0.1);
  backdrop-filter: none;
}

[data-theme="light"] .btn--ghost:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .badge--dark {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

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

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text-inverse);
  background-color: var(--color-surface-dark);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

/* ---- Typography Classes ---- */
.text-display {
  font-size: clamp(2.5rem, 6vw, var(--font-size-7xl));
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.text-h1 {
  font-size: clamp(2rem, 4vw, var(--font-size-5xl));
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.text-h2 {
  font-size: clamp(1.75rem, 3vw, var(--font-size-4xl));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.text-h3 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: 1.25;
}

.text-h4 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.3;
}

.text-body {
  font-size: var(--font-size-base);
  line-height: 1.6;
}

.text-body-lg {
  font-size: var(--font-size-lg);
  line-height: 1.65;
}

.text-small {
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.text-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.text-primary-color { color: var(--color-primary); }
.text-secondary { color: var(--color-text-inverse-secondary); }
.text-white { color: var(--color-text-inverse); }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .container { padding: 0 var(--space-6); }
}

@media (min-width: 1024px) {
  .container { padding: 0 var(--space-8); }
}

.section {
  padding: var(--space-24) 0;
}

.section--compact {
  padding: var(--space-16) 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 48px;
  padding: 0 var(--space-8);
  font-size: var(--font-size-sm);
  font-weight: 700;
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(236, 91, 19, 0.35);
}

.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn--secondary:hover {
  background: var(--color-primary);
  color: white;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn--sm {
  height: 40px;
  padding: 0 var(--space-5);
  font-size: var(--font-size-xs);
}

.btn--lg {
  height: 56px;
  padding: 0 var(--space-10);
  font-size: var(--font-size-base);
}

/* ---- Cards ---- */
.card {
  background: var(--color-surface-dark-card);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--color-border-dark-hover);
  box-shadow: var(--shadow-dark-card);
}

.card--interactive:hover {
  border-color: rgba(236, 91, 19, 0.3);
  transform: translateY(-2px);
}

.card--glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---- Badge / Tag ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}

.badge--primary {
  background: var(--color-primary-medium);
  color: var(--color-primary);
  border: 1px solid rgba(236, 91, 19, 0.3);
}

.badge--dark {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-inverse-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ---- Pulse Dot (live indicator) ---- */
.pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulse-ring 2s ease-out infinite;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-primary);
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.75; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ---- Icon Container ---- */
.icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--color-primary-light);
  color: var(--color-primary);
  transition: transform var(--transition-base);
}

.icon-box--sm {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
}

/* ---- Section Header ---- */
.section-header {
  margin-bottom: var(--space-16);
}

.section-header__label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.section-header__title {
  font-size: clamp(1.875rem, 4vw, var(--font-size-5xl));
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text-inverse);
}

.section-header__subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-inverse-secondary);
  margin-top: var(--space-4);
  max-width: 640px;
}

/* ---- Grid Utilities ---- */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

@media (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

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

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }

/* ---- Scrollbar (dark theme) ---- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface-dark);
}

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

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

/* ---- Selection ---- */
::selection {
  background: rgba(236, 91, 19, 0.3);
  color: white;
}

/* ---- Focus Visible ---- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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