:root {
    /* Primary color system - 60-30-10 rule */
    
    /* Neutral colors (60%) - Primary backgrounds and text */
    --neutral-50: #F9FAFB;
    --neutral-100: #FAFAFB;
    --neutral-200: #F1F5F9;
    --neutral-300: #E5E7EB;
    --neutral-400: #6B7280;
    --neutral-600: #4a4a4a;
    --neutral-800: #1a1a1a;
    
    /* Brand colors (30%) - Navigation and sections */
    --primary-300: #60A5FA;
    --primary-400: #3B82F6;
    --primary-500: #2563EB;
    --primary-600: #1E3A8A;
    --primary-700: #1E40AF;
    
    /* Accent color (10%) - CTAs and highlights only */
    --accent-400: #E5C47A;
    --accent-500: #D7BA89;
    --accent-600: #C29D58;
    
    /* Semantic color mappings - Enhanced for accessibility */
    --text-primary: var(--neutral-800);
    --text-secondary: var(--neutral-600);
    --text-tertiary: var(--neutral-400);
    --text-brand: var(--primary-600);
    --text-accent: var(--accent-600);
    
    --bg-primary: var(--neutral-100);
    --bg-secondary: var(--neutral-200);
    --bg-tertiary: var(--neutral-50);
    --bg-brand: var(--primary-600);
    --bg-brand-light: var(--primary-300);
    --bg-accent: var(--accent-500);
    
    --border-color: var(--neutral-300);
    --border-brand: var(--primary-400);
    --border-accent: var(--accent-400);
    
    /* Dark mode colors - Enhanced contrast */
    --dark-bg-primary: #0F0F0F;
    --dark-bg-secondary: #1A1A1A;
    --dark-bg-tertiary: #262626;
    --dark-text-primary: #F5F5F5;
    --dark-text-secondary: #B3B3B3;
    --dark-text-tertiary: #9CA3AF;
    --dark-border: #404040;
    --dark-border-light: #2A2A2A;
    
    /* Navigation specifics */
    --nav-bg-light: rgba(250, 250, 251, 0.95);
    --nav-border-light: rgba(30, 58, 138, 0.1);
    --nav-bg-dark: rgba(26, 26, 26, 0.95);
    --nav-border-dark: rgba(255, 255, 255, 0.1);
    
    /* Spacing scale */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;
    
    /* Typography scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 3.75rem;
    
    /* Line heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    
    /* Content constraints */
    --content-width-narrow: 600px;
    --content-width-medium: 800px;
    --content-width-wide: 1000px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    background-color: var(--bg-primary);
}

html.light-mode {
    background-color: #FAFAFB;
    color-scheme: light;
}

html.dark-mode {
    background-color: #0F0F0F;
    color-scheme: dark;
}

/* Prevent Flash of Undefined Custom Elements (FOUCE) */
site-header:not(:defined),
site-footer:not(:defined),
custom-project-card:not(:defined) {
    display: none;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.6;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
    transition: background-color 0.3s ease, color 0.3s ease;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

/* Theme classes - Enhanced accessibility */
body.light-mode {
    --text-primary: var(--neutral-800);
    --text-secondary: var(--neutral-600);
    --text-tertiary: var(--neutral-400);
    --bg-primary: var(--neutral-100);
    --bg-secondary: var(--neutral-200);
    --bg-tertiary: var(--neutral-50);
    --border-color: var(--neutral-300);
    --bg-white: #FFFFFF;
}

body.dark-mode {
    --text-primary: var(--dark-text-primary);
    --text-secondary: var(--dark-text-secondary);
    --text-tertiary: var(--dark-text-tertiary);
    --bg-primary: var(--dark-bg-primary);
    --bg-secondary: var(--dark-bg-secondary);
    --bg-tertiary: var(--dark-bg-tertiary);
    --border-color: var(--dark-border);
    --bg-white: var(--dark-bg-secondary);
}

/* Typography System */
.serif {
    font-family: 'Crimson Pro', Georgia, serif;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: var(--line-height-tight);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-md);
}

/* Typography classes */
.text-6xl { 
    font-size: var(--text-6xl); 
    line-height: var(--line-height-tight);
    font-weight: 700;
    letter-spacing: -0.025em;
}
.text-5xl { 
    font-size: var(--text-5xl); 
    line-height: var(--line-height-tight);
    font-weight: 600;
    letter-spacing: -0.025em;
}
.text-4xl { 
    font-size: var(--text-4xl); 
    line-height: var(--line-height-tight);
    font-weight: 600;
    letter-spacing: -0.025em;
}
.text-3xl { 
    font-size: var(--text-3xl); 
    line-height: var(--line-height-normal);
    font-weight: 600;
}
.text-2xl { 
    font-size: var(--text-2xl); 
    line-height: var(--line-height-normal);
    font-weight: 600;
}
.text-xl { 
    font-size: var(--text-xl); 
    line-height: var(--line-height-normal);
    font-weight: 500;
}
.text-lg { 
    font-size: var(--text-lg); 
    line-height: var(--line-height-relaxed);
    font-weight: 400;
}
.text-base { 
    font-size: var(--text-base); 
    line-height: var(--line-height-relaxed);
    font-weight: 400;
}
.text-sm { 
    font-size: var(--text-sm); 
    line-height: var(--line-height-normal);
    font-weight: 400;
}

/* Color utilities - 60-30-10 compliant */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-brand { color: var(--text-brand); }
.text-accent { color: var(--text-accent); }
.text-white { color: white; }

/* Background colors - Proper hierarchy */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }
.bg-brand { background-color: var(--bg-brand); }
.bg-brand-light { background-color: var(--bg-brand-light); }
.bg-accent { background-color: var(--bg-accent); }
.bg-white { background-color: var(--bg-white); }
.bg-soft { background-color: var(--bg-secondary); }
.bg-deep-charcoal { background-color: var(--dark-bg-tertiary); }

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

.section {
    padding: var(--space-3xl) 0;
    position: relative;
    z-index: 1;
}

.section-heading-container {
    text-align: center;
    max-width: var(--content-width-medium);
    margin: 0 auto;
}

/* Grid System */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2xl);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2xl);
}

.row-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
}

/* About Section - Simplified and Unified */
.about-content {
    max-width: var(--content-width-medium);
    margin: 0 auto;
    text-align: center;
}

.about-content h2 {
    color: var(--text-primary);
}

.about-highlight {
    color: var(--text-secondary);
    font-weight: 500;
    font-style: italic;
    margin-bottom: var(--space-2xl);
}

.about-story {
    text-align: left;
    max-width: 100%;
    margin-bottom: var(--space-3xl);
}

.about-story p {
    color: var(--text-primary);
    line-height: var(--line-height-relaxed);
}

.stats-showcase {
    align-self: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Flex utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* Spacing Utilities */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.py-xs { padding-top: var(--space-xs); padding-bottom: var(--space-xs); }
.py-sm { padding-top: var(--space-sm); padding-bottom: var(--space-sm); }
.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
.py-xl { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }
.py-2xl { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 80px;
    overflow: hidden;
}

/* Page hero for sub-pages */
.page-hero {
    padding-top: 120px;
    padding-bottom: 60px;
    min-height: auto;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.hero-description {
    max-width: var(--content-width-medium);
}

/* Parallax Background - Adjusted for proper 60-30-10 distribution */
.hero-parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(30, 58, 138, 0.03) 0%, 
        rgba(59, 130, 246, 0.02) 50%, 
        rgba(215, 186, 137, 0.02) 100%);
    z-index: 0;
}

/* Cards */
.card {
    background: var(--bg-white);
    padding: var(--space-xl);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-600);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

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

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

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-600);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 var(--space-md);
    }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .about-content {
        text-align: center;
    }
    
    .about-story {
        text-align: center;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .text-6xl {
        font-size: var(--text-5xl);
    }
    
    .text-5xl {
        font-size: var(--text-4xl);
    }
    
    .text-4xl {
        font-size: var(--text-3xl);
    }
    
    .section {
        padding: var(--space-2xl) 0;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 var(--space-sm);
    }
    
    .text-6xl {
        font-size: var(--text-4xl);
    }
    
    .hero {
        min-height: 80vh;
    }
}
