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

:root {
    /* Light theme */
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --text-muted: #666666;
    --border-color: #e5e5e5;
    --accent-color: #2563eb;
    --hover-color: #f5f5f5;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark theme */
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --text-muted: #a3a3a3;
    --border-color: #333333;
    --accent-color: #3b82f6;
    --hover-color: #1a1a1a;
    --shadow: 0 1px 3px rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    padding: 2rem 0 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.name {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 1rem;
    display: block;
}

.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.theme-toggle:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: #1d4ed8;
}

.nav-link.active {
    color: var(--accent-color);
    font-weight: 500;
    border-bottom: 2px solid var(--accent-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.2s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Main content */
.main {
    margin-bottom: 3rem;
}

.section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

/* About section */
.about-content {
    max-width: 800px;
}

.about-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.about-text {
    flex: 1;
}

.about-content p {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Resume section */
.resume-content {
    max-width: 800px;
}

.resume-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.resume-list li {
    margin-bottom: 0.5rem;
}

.resume-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s ease;
}

.resume-link:hover {
    color: #1d4ed8;
}

/* Projects section */
.projects-content {
    max-width: 800px;
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 1.5rem 0 0.5rem 0;
}

.subsection-title:first-child {
    margin-top: 0;
}

.projects-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 1.5rem 0;
}

.projects-list li {
    margin-bottom: 0.5rem;
}

.project-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s ease;
}

.project-link:hover {
    color: #1d4ed8;
}

.resume-preview h3 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.resume-preview h4 {
    color: var(--text-color);
    font-size: 1.2rem;
    margin: 1.5rem 0 0.5rem 0;
    font-weight: 600;
}

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

.resume-summary ul {
    margin-left: 1.5rem;
    color: var(--text-color);
}

.resume-summary li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Responsive design for about section */
@media (max-width: 768px) {
    .about-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .profile-photo {
        width: 150px;
        height: 150px;
        align-self: center;
    }
    
    .resume-actions {
        flex-direction: column;
    }
    
    .resume-download {
        justify-content: center;
    }
}

/* Essays section */
.essays-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.essays-list li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1rem;
}

.essays-list li::before {
    content: "•";
    color: var(--text-muted);
    position: absolute;
    left: 0;
    top: 0;
}

.essay-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 400;
    transition: color 0.2s ease;
    display: inline;
}

.essay-link:hover {
    color: #1d4ed8;
}

/* Essay content page */
.essay-content {
    max-width: 700px;
    margin: 0 auto;
}

.essay-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.essay-date {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-weight: 400;
}

.essay-body {
    line-height: 1.7;
    color: var(--text-color);
}

.essay-body p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 400;
}

.essay-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 2.5rem 0 1rem 0;
}

/* Reading section */
.reading-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.book-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    background-color: var(--bg-color);
}

.book-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.book-cover {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
}

.book-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.book-author {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.book-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
}

.reading-stats {
    text-align: center;
    padding: 1rem;
    background-color: var(--hover-color);
    border-radius: 8px;
    color: var(--text-muted);
}

/* Contact section */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.contact-link:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.contact-icon {
    font-size: 1.1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 1.5rem 0 1rem;
    }
    
    .name {
        font-size: 1.5rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .essay-link {
        font-size: 1.1rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    .book-cover {
        width: 60px;
        height: 90px;
    }
    
    .contact-links {
        flex-direction: column;
    }
    
    .contact-link {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Focus styles for accessibility */
.nav-link:focus,
.contact-link:focus,
.theme-toggle:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

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

.essay-item,
.book-item {
    animation: fadeIn 0.3s ease-out;
}
