/* CSS Custom Properties (Design System) */
:root {
  /* Colors */
  --primary-bg: #0a0a0a;
  --secondary-bg: #1a1a1a;
  --accent-color: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-tertiary: #999999;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Monaco, 'Cascadia Code', monospace;
  
  /* Spacing Scale (8px base) */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 1rem;     /* 16px */
  --space-md: 1.5rem;   /* 24px */
  --space-lg: 2rem;     /* 32px */
  --space-xl: 3rem;     /* 48px */
  --space-2xl: 4rem;    /* 64px */
  --space-3xl: 6rem;    /* 96px */
  
  /* Typography Scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --text-3xl: clamp(2rem, 1.7rem + 1.5vw, 3rem);
  --text-4xl: clamp(2.5rem, 2rem + 2.5vw, 4rem);
  
  /* Layout */
  --container-max-width: 1200px;
  --container-padding: var(--space-md);
  --section-padding: var(--space-3xl);
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.3s ease-out;
  --transition-slow: 0.5s ease-out;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-primary);
  background-color: var(--primary-bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

a:hover, a:focus {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Focus Management for Accessibility */
:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Skip Navigation Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--accent-color);
  color: var(--primary-bg);
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 10000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 6px;
  outline: 2px solid var(--primary-bg);
  outline-offset: 2px;
}

/* Layout Utilities */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

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

/* Navigation */
.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--transition-normal);
  transform: translateY(0);
}

.nav-header.scrolled {
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--container-padding);
  max-width: var(--container-max-width);
  margin: 0 auto;
}

.nav-brand h1 {
  font-size: var(--text-lg);
  margin: 0;
  font-weight: 700;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
  margin: 0;
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-links a:hover, .nav-links a:focus {
  background: var(--glass-bg);
  text-decoration: none;
}

.nav-links a.active {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent-color);
  border-radius: 50%;
}

.scroll-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition-fast);
  width: 0%;
}

/* Responsive Navigation */
@media (max-width: 768px) {
  .nav-links {
    gap: var(--space-md);
  }
  
  .nav-links a {
    font-size: var(--text-xs);
    padding: var(--space-xs);
  }
}

/* Section Styles */
section {
  padding: var(--section-padding) 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-md);
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: gradient-shift 3s ease-in-out infinite;
}

.section-description {
  text-align: center;
  margin-bottom: var(--space-2xl);
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Hero Section */
.hero-section {
  background: radial-gradient(ellipse at center, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-md);
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
}

.cta-button {
  display: inline-block;
  padding: var(--space-sm) var(--space-xl);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-weight: 600;
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease-out;
}

.cta-button:hover::before {
  left: 100%;
}

.cta-button:hover, .cta-button:focus {
  background: var(--gradient-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  text-decoration: none;
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(20px);
}

/* Grid Layouts */
.thoughts-grid, .ideas-grid, .projects-grid, .reading-grid {
  display: grid;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.thoughts-grid {
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.ideas-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.projects-grid {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.reading-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Responsive Grid Adjustments */
@media (max-width: 768px) {
  .thoughts-grid, .ideas-grid, .projects-grid, .reading-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* Timeline Layout */
.observations-timeline {
  max-width: 800px;
  margin: var(--space-2xl) auto 0;
}

/* Footer */
.footer {
  background: var(--secondary-bg);
  padding: var(--space-2xl) 0;
  text-align: center;
  border-top: 1px solid var(--glass-border);
}

.footer p {
  color: var(--text-tertiary);
  margin: 0;
}

/* Utility Classes */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.glass-effect {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --text-secondary: #ffffff;
    --text-tertiary: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.2);
    --glass-border: rgba(255, 255, 255, 0.4);
  }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  .section-title {
    animation: none;
  }
  
  .cta-button:hover {
    transform: none;
  }
}
