/* A modern CSS reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #fff;
    padding: 1rem 2rem;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin-bottom: 0.5rem;
}

header nav {
    display: flex;
}

header nav a {
    margin: 0 1rem;
    text-decoration: none;
    color: #007BFF;
}

main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
}

section {
    background-color: #fff;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

h2 {
    margin-bottom: 1rem;
    color: #333;
}

footer {
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #666;
}



/* Dark Theme Styles */
body.dark-theme {
    background-color: #1a1a1a;
    color: #f4f4f4;
}

body.dark-theme header {
    background-color: #2c2c2c;
    border-bottom-color: #444;
}

body.dark-theme section {
    background-color: #2c2c2c;
    box-shadow: 0 2px 5px rgba(255,255,255,0.1);
}

body.dark-theme h2 {
    color: #f4f4f4;
}

body.dark-theme header nav a {
    color: #3498db;
}

body.dark-theme footer {
    color: #aaa;
}

/* --- Project Grid Styles --- */
.projects-grid-container {
    display: grid;
    /* Create columns that are at least 250px wide, but stretch to fill space */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem; /* This is the space between the grid items */
}

.project-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    /* Add a subtle transition for a nice hover effect */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* We need to apply the dark theme to the new card styles too */
body.dark-theme .project-card {
    background-color: #333;
    border-color: #444;
}

/* --- Blog Styles --- */
.post-list .post-entry {
    border-bottom: 1px solid #eee;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.post-list .post-entry:last-child {
    border-bottom: none;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-main {
    max-width: 750px; /* A little narrower for better readability */
}

.post-content h1 {
    margin-bottom: 0.5rem;
}

.post-content p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.post-content pre {
    background-color: #f4f4f4;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto; /* Handle long lines of code */
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    text-decoration: none;
    color: #007BFF;
}

.post-tags {
    margin-top: 1rem;
}
.post-tag {
    display: inline-block;
    background-color: #f0f0f0;
    color: #555;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}
body.dark-theme .post-tag {
    background-color: #3a3a3a;
    color: #ccc;
}


/* Dark theme adjustments */
body.dark-theme .post-list .post-entry {
    border-bottom-color: #444;
}
body.dark-theme .post-meta {
    color: #aaa;
}
body.dark-theme .post-content pre {
    background-color: #111;
}
body.dark-theme .back-link {
    color: #3498db;
}

/* --- Tag Filter Styles --- */
#tag-filter-container {
    margin-top: 1rem; /* Add this line to control the space above */
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-button {
    background-color: #eee;
    color: #333;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.tag-button:hover {
    background-color: #ddd;
}

.tag-button.active {
    background-color: #007BFF;
    color: #fff;
}

/* Dark theme adjustments */
body.dark-theme .tag-button {
    background-color: #444;
    color: #f4f4f4;
}

body.dark-theme .tag-button:hover {
    background-color: #555;
}

body.dark-theme .tag-button.active {
    background-color: #3498db;
    color: #fff;
}


/* --- Responsive Styles --- */

@media (max-width: 768px) {
    header {
        /* Make the header items stack vertically */
        flex-direction: column;
        padding: 1rem;
    }

    header nav {
        /* Add some space between the nav links and the title */
        margin-top: 1rem;
    }

    header nav a {
        /* Give the links a bit more space on mobile */
        margin: 0 0.5rem;
    }

    main {
        /* Reduce the side padding on small screens */
        padding: 0 1rem;
        margin: 1rem auto;
    }

    section {
        /* Reduce padding inside the content cards */
        padding: 1.5rem;
    }
}
