/* ============================================
   Modern Theme System for Academic Website
   Drop-in replacement for current theme.css
   ============================================ */

/* Import Google Fonts - keeping your existing + adding Inter for modern feel */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,400;0,500;0,600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@300;400&display=swap');

/* CSS Variables for consistent theming */
:root {
  /* Colors - based on your existing palette but enhanced */
  --primary-color: #3D6E74;
  --primary-hover: #2a4f54;
  --secondary-color: #64748b;
  --accent-color: #93bdbf;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  
  /* Text colors */
  --text-primary: #404041;
  --text-secondary: #666666;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Background colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f9f9f9;
  --bg-tertiary: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  /* Borders */
  --border-color: #e2e8f0;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  
  /* Shadows - more subtle than before */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  
  /* Typography - Inter for modern feel, fallback to your Open Sans */
  --font-sans: 'Inter', 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Source Code Pro', 'Courier New', monospace;
  --font-condensed: 'Barlow Condensed', sans-serif;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* Dark mode variables */
[data-theme="dark"] {
  --primary-color: #93bdbf;
  --primary-hover: #7aacae;
  --secondary-color: #94a3b8;
  --accent-color: #93bdbf;
  
  --text-primary: #F0F0F0;
  --text-secondary: #c9c9c9;
  --text-muted: #94a3b8;
  
  --bg-primary: #1a1a1b;
  --bg-secondary: #242426;
  --bg-tertiary: #2a2a2c;
  --bg-hover: #3a3a3c;
  
  --border-color: #3a3a3c;
  
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* Base reset and improvements */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body - using CSS variables instead of !important */
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Typography with better hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.2;
  transition: color var(--transition-base);
}

h1 {
  font-weight: 700;
  font-size: 2.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-weight: 600;
  font-size: 2rem;
  letter-spacing: -0.01em;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-weight: 600;
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

/* Paragraph spacing */
p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* Links with better transitions */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Code styling */
code {
  font-family: var(--font-mono);
  color: #9a4665;
  font-size: 0.875em;
  padding: 0.2em 0.4em;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
}

[data-theme="dark"] code {
  color: #cca2b2;
  background-color: var(--bg-tertiary);
}

/* Selection colors */
::selection {
  background-color: var(--accent-color);
  color: var(--text-primary);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Page fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main {
  animation: fadeIn 0.3s ease-out;
}

/* Footer styling */
.footer-content {
  font-family: var(--font-condensed);
  font-weight: 300;
  color: var(--text-muted);
  transition: color var(--transition-base);
}

/* Navbar improvements */
.navbar {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-base);
}

[data-theme="dark"] .navbar {
  background-color: rgba(26, 26, 27, 0.9);
}

.navbar a {
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.navbar a:hover {
  background-color: var(--bg-hover);
  text-decoration: none;
}

/* TOC improvements */
.toc-active {
  font-weight: 600;
  color: var(--primary-color);
}

/* Responsive typography */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

/* Print styles */
@media print {
  body {
    color: #000;
    background: #fff;
  }
  
  .navbar, .theme-toggle {
    display: none;
  }
}

/* Accessibility - reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 2px;
}