/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables - Light theme (default) */
:root {
    --bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e5e5e5;
    --accent: #0066cc;
    --accent-hover: #0052a3;
    --surface: #fafafa;
    --shadow: rgba(0, 0, 0, 0.04);
    --shadow-hover: rgba(0, 0, 0, 0.08);
}

/* Dark theme based on system preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1421;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border: #1e293b;
        --accent: #38bdf8;
        --accent-hover: #0ea5e9;
        --surface: #1e293b;
        --shadow: rgba(56, 189, 248, 0.1);
        --shadow-hover: rgba(56, 189, 248, 0.2);
    }
}

/* Manual theme overrides */
[data-theme="light"] {
    --bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e5e5e5;
    --accent: #0066cc;
    --accent-hover: #0052a3;
    --surface: #fafafa;
    --shadow: rgba(0, 0, 0, 0.04);
    --shadow-hover: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --bg: #0d1421;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --surface: #1e293b;
    --shadow: rgba(56, 189, 248, 0.1);
    --shadow-hover: rgba(56, 189, 248, 0.2);
}

/* Base typography */
body {
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: .1px;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    transition: background-color 0.2s ease, color 0.2s ease;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
    color: var(--text-secondary);
}

.theme-toggle:hover {
    background: var(--bg);
    box-shadow: 0 2px 8px var(--shadow-hover);
    color: var(--text-primary);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    transition: opacity 0.2s ease;
}

[data-theme="light"] .theme-toggle .sun-icon {
    opacity: 0;
    position: absolute;
}

[data-theme="light"] .theme-toggle .moon-icon {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 0;
    position: absolute;
}

/* Hero section */
.hero {
    margin-bottom: 4rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Social links */
.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: var(--text-muted);
    transition: color 0.2s ease;
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover {
    color: var(--accent);
    background: var(--surface);
}

/* Sections */
section {
    margin-bottom: 3rem;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* About section */
.about p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.about a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.about a:hover {
    border-bottom-color: var(--accent);
}

/* Projects */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.project {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    transition: all 0.2s ease;
}

.project:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-1px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.project h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.year {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.project p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* Tech stack */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-stack span {
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-weight: 500;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 3rem 1.5rem;
    }
    
    .theme-toggle {
        top: 1.5rem;
        right: 1.5rem;
        width: 36px;
        height: 36px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .project {
        padding: 1.25rem;
    }
    
    .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .year {
        order: -1;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 2rem 1rem;
    }
    
    .hero {
        margin-bottom: 3rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 0.9375rem;
        margin-bottom: 1.5rem;
    }
    
    .social-links {
        gap: 0.5rem;
    }
    
    .social-links a {
        padding: 0.375rem;
    }
    
    .project {
        padding: 1rem;
    }
    
    .tech-stack {
        gap: 0.375rem;
    }
    
    .tech-stack span {
        font-size: 0.75rem;
        padding: 0.1875rem 0.625rem;
    }
}

/* Focus styles for accessibility */
.theme-toggle:focus,
.social-links a:focus,
.about a:focus,
.project:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

/* Print styles */
@media print {
    .theme-toggle {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .project {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
    }
}
