* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f4f4f4;
    --text-primary: #333;
    --text-secondary: #555;
    --text-tertiary: #666;
    --text-muted: #999;
    --border-color: #e0e0e0;
    --link-color: #333;
    --link-hover: #000;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    --card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #909090;
    --text-muted: #707070;
    --border-color: #404040;
    --link-color: #e0e0e0;
    --link-hover: #ffffff;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 3rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-secondary);
    border-color: var(--text-tertiary);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    width: 20px;
    height: 20px;
}

[data-theme="light"] .moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: none;
}

nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--link-hover);
}

.content-wrapper {
    flex: 1;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

main {
    flex: 1;
    min-width: 0;
}

section {
    margin-bottom: 4rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Experience section */
.experience-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.experience-item h3 {
    color: var(--text-primary);
}

.experience-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* Projects section */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--text-tertiary);
}

.project-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.project-card > p {
    flex: 1;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background-color: var(--bg-tertiary);
    color: var(--text-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.project-link:hover {
    color: var(--link-hover);
}

.project-link svg {
    flex-shrink: 0;
}

/* Blog styles */
.blog-list {
    list-style: none;
}

.blog-list li {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.blog-list li:last-child {
    border-bottom: none;
}

.blog-list h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.blog-list h3 a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}

.blog-list h3 a:hover {
    color: var(--link-hover);
}

.blog-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.blog-excerpt {
    color: var(--text-secondary);
}

.read-more {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.9rem;
}

.read-more:hover {
    color: var(--link-hover);
}

/* Blog post styles */
article h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

article h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

article h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

article p {
    margin-bottom: 1.25rem;
}

article code {
    background-color: var(--bg-tertiary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--text-primary);
}

article pre {
    background-color: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

article pre code {
    background-color: transparent;
    padding: 0;
}

article ul, article ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
}

article li {
    margin-bottom: 0.5rem;
}

article blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    margin: 1.25rem 0;
    color: var(--text-tertiary);
    font-style: italic;
}

article a {
    color: var(--link-color);
    text-decoration: underline;
}

article a:hover {
    color: var(--link-hover);
}

.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--text-tertiary);
    text-decoration: none;
}

.back-link:hover {
    color: var(--link-hover);
}

/* Skills section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.skill-group {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.skill-group:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--text-tertiary);
}

.skill-group h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.skill-group p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Recent Posts Sidebar */
.recent-posts {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.recent-posts h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.recent-posts ul {
    list-style: none;
}

.recent-posts li {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.recent-posts li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.recent-posts a {
    text-decoration: none;
    display: block;
    transition: transform 0.2s ease;
}

.recent-posts a:hover {
    transform: translateX(2px);
}

.recent-posts h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--link-color);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.recent-posts a:hover h4 {
    color: var(--link-hover);
}

.recent-posts p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    line-height: 1.4;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }

    .recent-posts {
        width: 100%;
        position: static;
        max-height: none;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }
    
    nav {
        gap: 1rem;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }
}