/* ═══════════════════════════════════════════════════════════
   CG Hunter Platform — Design System v2.0
   Unified design tokens for portal/auth/tutorials/AW pages
   ═══════════════════════════════════════════════════════════ */

/* ══ LIGHT THEME (Default — portal / tutorials) ══ */
:root {
  /* Brand */
  --color-brand: #6366f1;
  --color-brand-light: #818cf8;
  --color-brand-dark: #4f46e5;
  --color-brand-glow: rgba(99, 102, 241, 0.3);
  --gradient-brand: linear-gradient(135deg, #6366f1, #8b5cf6);

  /* Gold Accent */
  --color-gold: #D4AF37;
  --color-gold-muted: rgba(212, 175, 55, 0.12);

  /* Semantic */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: var(--color-brand);

  /* Gray Scale */
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --gray-950: #0a0a0a;

  /* Surfaces — Light */
  --bg-base: #F5F3EC;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-floating: #ffffff;
  --bg-header: rgba(245, 243, 236, 0.92);

  /* Text — Light */
  --text-primary: #161616;
  --text-secondary: rgba(22, 22, 22, 0.65);
  --text-tertiary: rgba(22, 22, 22, 0.45);
  --text-disabled: rgba(22, 22, 22, 0.25);
  --text-link: var(--color-brand);
  --text-price: var(--color-gold);

  /* Borders — Light */
  --border-subtle: rgba(22, 22, 22, 0.06);
  --border-default: rgba(22, 22, 22, 0.12);
  --border-strong: rgba(22, 22, 22, 0.2);
  --border-interactive: rgba(22, 22, 22, 0.3);

  /* Interactive — Light */
  --hover-bg: rgba(22, 22, 22, 0.04);
  --active-bg: rgba(22, 22, 22, 0.08);
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.3);

  /* ══ Typography ══ */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-sans: 'Space Grotesk', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-cjk: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;

  --text-xs: clamp(0.65rem, 0.6rem + 0.2vw, 0.75rem);
  --text-sm: clamp(0.78rem, 0.72rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.88rem, 0.82rem + 0.3vw, 1rem);
  --text-lg: clamp(1rem, 0.9rem + 0.4vw, 1.125rem);
  --text-xl: clamp(1.15rem, 1rem + 0.5vw, 1.25rem);
  --text-2xl: clamp(1.4rem, 1.2rem + 0.8vw, 1.5rem);
  --text-3xl: clamp(1.8rem, 1.4rem + 1.5vw, 2.25rem);
  --text-4xl: clamp(2.2rem, 1.6rem + 2.5vw, 3rem);
  --text-hero: clamp(3rem, 2rem + 4vw, 6rem);

  /* ══ Spacing ══ */
  --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;

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

  /* ══ Shadows — Light ══ */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px var(--color-brand-glow);

  /* ══ Transitions ══ */
  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-spring: cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.6s var(--ease-out);

  /* ══ Z-index ══ */
  --z-base: 1;
  --z-sticky: 100;
  --z-navbar: 1000;
  --z-dropdown: 1001;
  --z-overlay: 1500;
  --z-modal: 2000;
  --z-toast: 3000;
  --z-noise: 9999;
}

/* ══ DARK THEME (auth / store / admin) ══ */
[data-theme="dark"] {
  --bg-base: #0a0a0a;
  --bg-surface: #161616;
  --bg-elevated: #1c1c1c;
  --bg-floating: #242424;
  --bg-header: rgba(10, 10, 10, 0.95);

  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-disabled: #3f3f46;
  --text-link: var(--color-brand-light);

  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-interactive: rgba(255, 255, 255, 0.2);

  --hover-bg: rgba(255, 255, 255, 0.04);
  --active-bg: rgba(255, 255, 255, 0.08);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.6);
}

/* ══ RESET ══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.02em;
}
::selection { background: rgba(99, 102, 241, 0.15); color: var(--text-primary); }
a { text-decoration: none; color: inherit; transition: color var(--transition-fast); }
img { max-width: 100%; display: block; }

/* ══ Noise Overlay ══ */
.noise {
  position: fixed; inset: 0; z-index: var(--z-noise); pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ══ Glass Morphism ══ */
.glass {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
}
[data-theme="dark"] .glass {
  background: rgba(22, 22, 22, 0.6);
}

/* ══ Scrollbar ══ */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
