/* --- Global Layout Styles --- */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    flex: 1; /* Allow container to grow and fill available space */
    display: flex;
    flex-direction: column;
    max-width: 1200px; /* Wider container */
    margin: 20px auto; /* Add margin on top/bottom */
    padding: 30px; /* Adjust padding */
}

/* --- Header Styles --- */
.site-header {
    width: 100%;
    margin-bottom: 30px;
    background-color: var(--container-bg-light); /* Match container bg */
    border-radius: 8px; /* Match container border-radius */
    box-shadow: 0 4px 15px var(--box-shadow-light); /* Match container shadow */
    padding: 15px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s, box-shadow 0.3s;
}

body.dark-mode .site-header {
    background-color: var(--container-bg-dark);
    box-shadow: 0 4px 15px var(--box-shadow-dark);
}

.site-header-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.site-title a {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

body.dark-mode .site-title a {
    color: var(--secondary-color);
}

.site-nav {
    display: flex;
    justify-content: center;
    gap: 30px; /* Increased gap */
    width: 100%;
}

.site-nav a {
    text-decoration: none;
    color: var(--text-color-light);
    font-weight: 500; /* Slightly lighter */
    font-size: 1.1em;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s;
}

body.dark-mode .site-nav a {
    color: var(--text-color-dark);
}

.site-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    display: block;
    margin-top: 5px;
    right: 0;
    background: var(--primary-color);
    transition: width 0.2s ease;
    -webkit-transition: width 0.2s ease;
}

body.dark-mode .site-nav a::after {
    background: var(--secondary-color);
}

.site-nav a:hover::after {
    width: 100%;
    left: 0;
    background: var(--primary-color);
}

body.dark-mode .site-nav a:hover::after {
    background: var(--secondary-color);
}


/* --- Hero Section --- */
.hero-section {
    position: relative;
    width: calc(100% + 60px); /* Account for container padding */
    left: -30px; /* Align to container edge */
    height: 400px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    margin-bottom: 40px;
    border-radius: 8px; /* Match container border-radius */
    overflow: hidden; /* Ensure image doesn't overflow */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4); /* Dark overlay */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.hero-overlay h1 {
    color: white;
    font-size: 3.5em;
    margin-bottom: 10px;
}

.hero-overlay p {
    font-size: 1.5em;
    max-width: 800px;
    margin-bottom: 30px;
    color: #e0e0e0;
}

.hero-button {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1.2em;
    font-weight: 700;
    transition: background-color 0.3s;
}

.hero-button:hover {
    background-color: var(--button-hover-light);
}

/* --- Main Content Layout (for category cards / blog previews) --- */
main {
    flex-grow: 1;
}

.content-section {
    margin-bottom: 40px;
}

.section-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    color: var(--primary-color);
}

body.dark-mode .section-title {
    color: var(--secondary-color);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.card {
    background-color: var(--container-bg-light);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--box-shadow-light);
    padding: 25px;
    text-align: left;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
}

body.dark-mode .card {
    background-color: var(--container-bg-dark);
    box-shadow: 0 2px 10px var(--box-shadow-dark);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px var(--box-shadow-light);
}

body.dark-mode .card:hover {
    box-shadow: 0 6px 20px var(--box-shadow-dark);
}

.card h3 {
    margin-top: 0;
    font-size: 1.5em;
}

.card p {
    font-size: 0.95em;
    color: #666;
}

body.dark-mode .card p {
    color: #bbb;
}

.card a.button {
    display: inline-block;
    margin-top: 15px;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.3s;
}

.card a.button:hover {
    background-color: var(--button-hover-light);
}

body.dark-mode .card a.button {
    background-color: var(--secondary-color);
}

body.dark-mode .card a.button:hover {
    background-color: var(--button-hover-dark);
}

/* --- Footer Styles --- */
.site-footer {
    width: 100%;
    margin-top: 50px;
    padding: 20px 30px;
    border-top: 1px solid var(--border-color-light);
    font-size: 0.9em;
    color: #777;
    background-color: var(--container-bg-light); /* Match container bg */
    border-radius: 8px; /* Match container border-radius */
    box-shadow: 0 -2px 10px var(--box-shadow-light); /* Shadow above */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    transition: background-color 0.3s, box-shadow 0.3s, border-top-color 0.3s;
}

body.dark-mode .site-footer {
    background-color: var(--container-bg-dark);
    box-shadow: 0 -2px 10px var(--box-shadow-dark);
    border-top-color: var(--border-color-dark);
    color: #aaa;
}

.footer-content {
    display: flex; /* Changed from block to flex */
    justify-content: space-between;
    align-items: center;
    width: 100%; /* Ensure content spans full width */
    flex-wrap: wrap;
}

.footer-links a {
    text-decoration: none;
    color: #777;
    margin-left: 15px;
    transition: color 0.3s;
}

body.dark-mode .footer-links a {
    color: #aaa;
}

.footer-links a:hover {
    color: var(--primary-color);
}

body.dark-mode .footer-links a:hover {
    color: var(--secondary-color);
}

/* --- Blog Post Preview Styles (from previous step, refined) --- */
.blog-posts-list {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Use grid for blog list */
    gap: 30px;
}

.blog-post-preview {
    margin-bottom: 0; /* Managed by gap in grid */
    padding: 25px;
    border-radius: 8px;
    background-color: var(--container-bg-light);
    box-shadow: 0 2px 10px var(--box-shadow-light);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
}

body.dark-mode .blog-post-preview {
    background-color: var(--container-bg-dark);
    box-shadow: 0 2px 10px var(--box-shadow-dark);
}

.blog-post-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px var(--box-shadow-light);
}

body.dark-mode .blog-post-preview:hover {
    box-shadow: 0 6px 20px var(--box-shadow-dark);
}

.blog-post-preview h2 {
    font-size: 1.6em; /* Slightly smaller for previews */
    margin-top: 0;
    margin-bottom: 10px;
    line-height: 1.3;
}

.blog-post-preview h2 a {
    color: var(--text-color-light); /* Make title color consistent */
    text-decoration: none;
    transition: color 0.3s;
}

body.dark-mode .blog-post-preview h2 a {
    color: var(--text-color-dark);
}

.blog-post-preview h2 a:hover {
    color: var(--primary-color);
}

body.dark-mode .blog-post-preview h2 a:hover {
    color: var(--secondary-color);
}

.blog-post-preview .post-meta {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 15px;
}

body.dark-mode .blog-post-preview .post-meta {
    color: #ccc;
}

.blog-post-preview p {
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 15px;
}

.read-more {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 18px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.3s;
}

.read-more:hover {
    background-color: var(--button-hover-light);
}

body.dark-mode .read-more {
    background-color: var(--secondary-color);
}

body.dark-mode .read-more:hover {
    background-color: var(--button-hover-dark);
}

/* --- Article Specific Styles (for individual blog posts) --- */
article {
    text-align: left;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

article h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

article .post-meta {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 30px;
    display: block;
}

body.dark-mode article .post-meta {
    color: #ccc;
}

article h2 {
    font-size: 2em;
    margin-top: 30px;
    margin-bottom: 15px;
}

article h3 {
    font-size: 1.5em;
    margin-top: 25px;
    margin-bottom: 10px;
}

article p {
    margin-bottom: 1.2em;
}

article ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 1.2em;
}

article li {
    margin-bottom: 0.5em;
}