/* ============================================================
   BASE.CSS — PubliExpert AI Design System
   Purple/Blue gradient SaaS palette, dark-first
   ============================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root,
[data-theme="light"] {
  /* Surfaces */
  --color-bg: #f8f7fc;
  --color-surface: #ffffff;
  --color-surface-2: #f3f1fa;
  --color-surface-offset: #ede9f8;
  --color-divider: #e0daf0;
  --color-border: #d4cef0;

  /* Text */
  --color-text: #0f0c1e;
  --color-text-muted: #6b6480;
  --color-text-faint: #b8b2cc;
  --color-text-inverse: #f9f8fc;

  /* Primary — Electric Purple */
  --color-primary: #7c3aed;
  --color-primary-hover: #6d28d9;
  --color-primary-active: #5b21b6;
  --color-primary-light: #ede9fe;

  /* Accent — Electric Blue */
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-light: #dbeafe;

  /* Gradient */
  --gradient-brand: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  --gradient-brand-soft: linear-gradient(135deg, #ede9fe 0%, #dbeafe 100%);
  --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, 0.15) 0%, transparent 70%);

  /* Semantic */
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;

  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(124, 58, 237, 0.08);
  --shadow-md: 0 4px 16px rgba(124, 58, 237, 0.12);
  --shadow-lg: 0 12px 40px rgba(124, 58, 237, 0.18);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.25);

  /* Transitions */
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
}

/* ---------- DARK MODE ---------- */
[data-theme="dark"] {
  --color-bg: #07050f;
  --color-surface: #0d0b1a;
  --color-surface-2: #12102b;
  --color-surface-offset: #16143a;
  --color-divider: #1e1b3a;
  --color-border: #2a2750;

  --color-text: #e8e4ff;
  --color-text-muted: #8b83b0;
  --color-text-faint: #4a4470;
  --color-text-inverse: #07050f;

  --color-primary: #a78bfa;
  --color-primary-hover: #c4b5fd;
  --color-primary-active: #ddd6fe;
  --color-primary-light: rgba(167, 139, 250, 0.15);

  --color-accent: #60a5fa;
  --color-accent-hover: #93c5fd;
  --color-accent-light: rgba(96, 165, 250, 0.15);

  --gradient-brand: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
  --gradient-brand-soft: linear-gradient(135deg, rgba(167,139,250,0.2) 0%, rgba(96,165,250,0.2) 100%);
  --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(167, 139, 250, 0.2) 0%, transparent 70%);

  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 60px rgba(167, 139, 250, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #07050f;
    --color-surface: #0d0b1a;
    --color-surface-2: #12102b;
    --color-surface-offset: #16143a;
    --color-divider: #1e1b3a;
    --color-border: #2a2750;
    --color-text: #e8e4ff;
    --color-text-muted: #8b83b0;
    --color-text-faint: #4a4470;
    --color-text-inverse: #07050f;
    --color-primary: #a78bfa;
    --color-primary-hover: #c4b5fd;
    --color-primary-active: #ddd6fe;
    --color-primary-light: rgba(167, 139, 250, 0.15);
    --color-accent: #60a5fa;
    --color-accent-hover: #93c5fd;
    --color-accent-light: rgba(96, 165, 250, 0.15);
    --gradient-brand: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
    --gradient-brand-soft: linear-gradient(135deg, rgba(167,139,250,0.2) 0%, rgba(96,165,250,0.2) 100%);
    --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(167, 139, 250, 0.2) 0%, transparent 70%);
    --color-success: #34d399;
    --color-warning: #fbbf24;
    --color-error: #f87171;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 60px rgba(167, 139, 250, 0.2);
  }
}

/* ---------- TYPE SCALE ---------- */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);
  --text-hero: clamp(3rem, 0.5rem + 7vw, 6.5rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Fonts */
  --font-display: 'Cabinet Grotesk', 'Inter', sans-serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;
}

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

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-20);
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

ul[role='list'], ol[role='list'] { list-style: none; }

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

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.1;
  font-family: var(--font-display);
}

p, li, figcaption {
  text-wrap: pretty;
  max-width: 72ch;
}

::selection {
  background: rgba(124, 58, 237, 0.2);
  color: var(--color-text);
}

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

@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;
  }
}

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

a, button, [role='button'], input, textarea, select {
  transition: color var(--transition), background var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              opacity var(--transition), transform var(--transition);
}

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