/* CSS Variables - Light Theme */
:root {
   /* Principal Font - MOVED to inline CSS in HTML for faster loading */
  --font-family: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Principal Colours - Light Theme */
  --color-slate-900: #f8fafc;  
  --color-slate-800: #f1f5f9;  
  --color-slate-700: #e2e8f0;  
  --color-slate-600: #cbd5e1;  
  --color-slate-500: #94a3b8;  
  --color-slate-400: #64748b;  
  --color-slate-300: #475569;  
  --color-slate-200: #334155;  
  --color-slate-100: #1e293b;  
  
  /* Bramd colours */
  --color-indigo-900: #312e81;
  --color-indigo-800: #3730a3;
  --color-indigo-700: #4338ca;
  --color-indigo-600: #4f46e5;
  --color-indigo-500: #6366f1;
  --color-indigo-400: #818cf8;
  --color-indigo-300: #a5b4fc;
  
  --color-cyan-600: #0891b2;
  --color-cyan-500: #06b6d4;
  --color-cyan-400: #22d3ee;
  --color-cyan-300: #67e8f9;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  --spacing-4xl: 5rem;
  
  /* Layout */
  --max-width: 1120px;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  
  /* Transitions */
  --transition: all 0.3s ease;
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.5s ease;
  
  /* Shadows - Light Theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.20);
  --shadow-indigo: 0 10px 25px rgba(99, 102, 241, 0.35);
  --shadow-cyan: 0 10px 25px rgba(6, 182, 212, 0.35);
  
  /* Colours scheme */
  color-scheme: light;
}

/* CSS Variables - Dark Theme */
[data-theme="dark"] {
  /* Principal colours - Dark Theme */
  --color-slate-900: #0f172a;
  --color-slate-800: #1e293b;
  --color-slate-700: #334155;
  --color-slate-600: #475569;
  --color-slate-500: #64748b;
  --color-slate-400: #94a3b8;
  --color-slate-300: #cbd5e1;
  --color-slate-200: #e2e8f0;
  --color-slate-100: #f1f5f9;
  
  /* Shadows - Dark Theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
  --shadow-indigo: 0 10px 25px rgba(99, 102, 241, 0.25);
  --shadow-cyan: 0 10px 25px rgba(6, 182, 212, 0.25);
  
  /* Colours scheme */
  color-scheme: dark;
}

/* Reset CSS */
* {
  box-sizing: border-box;
  /* Smooth theme transition */
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html {
  font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-slate-900);
  color: var(--color-slate-300);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Base Elements */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0 0 var(--spacing-md);
}

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

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

/* Text utilities */
.text-gradient-indigo-cyan {
  background: linear-gradient(to right, var(--color-indigo-400), var(--color-cyan-400));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gradient-cyan-indigo {
  background: linear-gradient(to right, var(--color-cyan-400), var(--color-indigo-400));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.highlight-indigo {
  color: var(--color-indigo-400);
  font-weight: 600;
}

.highlight-cyan {
  color: var(--color-cyan-400);
  font-weight: 600;
}

/* Backgrounds - Light Theme */
.background-gradient {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(135deg, #fefefe 0%, rgba(248, 250, 252, 0.6) 50%, #f9fafb 100%);
}

.background-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 80% 80% at 50% -20%, rgba(99, 102, 241, 0.04), rgba(6, 182, 212, 0.02));
}

/* Backgrounds - Dark Theme */
[data-theme="dark"] .background-gradient {
  background: linear-gradient(135deg, var(--color-slate-900) 0%, rgba(49, 46, 129, 0.2) 50%, var(--color-slate-800) 100%);
}

[data-theme="dark"] .background-overlay {
  background: radial-gradient(ellipse 80% 80% at 50% -20%, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.1));
}

/* Principal Container */
.page-content {
  padding: 0 var(--spacing-lg);
}

@media (min-width: 640px) {
  .page-content {
    padding: 0 var(--spacing-xl);
  }
}

@media (min-width: 768px) {
  .page-content {
    padding: 0 var(--spacing-4xl);
  }
}

.main-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

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

::-webkit-scrollbar-track {
  background: var(--color-slate-800);
}

::-webkit-scrollbar-thumb {
  background: var(--color-indigo-500);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-cyan-500);
}

/* Animations */
@keyframes pulse {
  0%, 100% { 
    opacity: 1; 
  }
  50% { 
    opacity: 0.5; 
  }
}

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

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* Automatic system preference detection - ONLY when no manual theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    /* Dark theme variables for system preference */
    --color-slate-900: #0f172a;
    --color-slate-800: #1e293b;
    --color-slate-700: #334155;
    --color-slate-600: #475569;
    --color-slate-500: #64748b;
    --color-slate-400: #94a3b8;
    --color-slate-300: #cbd5e1;
    --color-slate-200: #e2e8f0;
    --color-slate-100: #f1f5f9;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    --shadow-indigo: 0 10px 25px rgba(99, 102, 241, 0.25);
    --shadow-cyan: 0 10px 25px rgba(6, 182, 212, 0.25);
    
    color-scheme: dark;
  }
}

/* Background adaptations for system dark preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .background-gradient {
    background: linear-gradient(135deg, #0f172a 0%, rgba(49, 46, 129, 0.2) 50%, #1e293b 100%);
  }
  
  :root:not([data-theme]) .background-overlay {
    background: radial-gradient(ellipse 80% 80% at 50% -20%, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.1));
  }
}