
/* style.css */

/* --- CSS Variables for easy customization --- */
:root {
    --primary-color: #007bff; /* Bright blue for accents */
    --secondary-color: #6c757d; /* Grey for secondary text/borders */
    --accent-color: #28a745; /* Green for success/call to action */
    --background-color: #f8f9fa; /* Light grey background */
    --text-color: #343a40; /* Dark grey for general text */
    --heading-color: #212529; /* Even darker for headings */
    --card-background: #ffffff; /* White for cards */
    --border-color: #e9ecef; /* Light border for elements */
    --dark-overlay: rgba(0, 0, 0, 0.6); /* Dark overlay for hero image */

    --font-family-base: 'Inter', sans-serif;
    --font-family-mono: 'Roboto Mono', monospace;

    --font-size-base: 1rem;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-h1: 2.5rem;
    --font-size-h2: 2rem;
    --font-size-h3: 1.75rem;
    --font-size-h4: 1.25rem;

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    --border-radius: 0.3rem;
    --box-shadow-sm: 0 .125rem .25rem rgba(0,0,0,.075);
    --box-shadow-md: 0 .25rem .5rem rgba(0,0,0,.1);
}

/* --- Base Styles & Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-sm);
    padding-right: var(--spacing-sm);
}

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

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: var(--font-size-h4); }

ul {
    list-style: none;
}

p {
    margin-bottom: var(--spacing-sm);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #0056b3; /* A darker shade of primary */
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
}

.btn-secondary:hover {
    background-color: #545b62; /* A darker shade of secondary */
    text-decoration: none;
}

/* --- Header --- */
.site-header {
    background-color: var(--card-background);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--box-shadow-sm);
    position: sticky; /* Makes header sticky on scroll */
    top: 0;
    z-index: 1000;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: var(--spacing-sm);
}

.site-logo {
    margin: 0;
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.site-logo a {
    color: var(--heading-color);
    text-decoration: none;
    font-weight: 700;
}

.site-logo a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.main-nav {
    flex-grow: 1; /* Allows nav to take up available space */
    text-align: center;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.main-nav a {
    color: var(--text-color);
    font-weight: 500;
    padding: var(--spacing-xs) 0;
    position: relative;
}

.main-nav a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

/* Underline effect on hover for nav links */
.main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

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

.search-bar {
    display: flex;
    gap: var(--spacing-xs);
    flex-shrink: 0;
}

.search-bar input[type="search"] {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    width: 180px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar input[type="search"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.search-bar button {
    background-color: var(--primary-color);
    color: #fff;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-bar button:hover {
    background-color: #0056b3;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    height: 600px; /* Fixed height for hero */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures image covers the area */
    z-index: 1;
}

.hero-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--dark-overlay);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 800px;
    padding: var(--spacing-md);
}

.hero-category {
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-xs);
    color: var(--accent-color);
}

.hero-title {
    font-size: var(--font-size-h1);
    margin-bottom: var(--spacing-sm);
    color: #fff;
}

.hero-excerpt {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-md);
    opacity: 0.9;
}

.hero-meta {
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-sm);
    opacity: 0.8;
}

.hero-meta span:first-child {
    font-weight: 500;
}

/* --- Main Content Layout (Blog Posts + Sidebar) --- */
.content-wrapper {
    display: grid;
    grid-template-columns: 3fr 1fr; /* 75% for posts, 25% for sidebar */
    gap: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
}

/* --- Blog Posts Section --- */
.blog-posts-section {
    grid-column: 1 / 2; /* Occupy first column */
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.section-header h2 {
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-h2);
}

.section-header p {
    font-size: var(--font-size-lg);
    color: var(--secondary-color);
}

.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Responsive grid for cards */
    gap: var(--spacing-lg);
}

.blog-post-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.blog-post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-md);
}

.blog-post-card a {
    color: inherit;
    text-decoration: none;
    display: flex; /* Ensures the whole card content is a flex item for spacing */
    flex-direction: column;
    height: 100%; /* Important for equal height cards */
}

.blog-post-card .post-image-container {
    height: 200px;
    overflow: hidden;
    flex-shrink: 0; /* Prevents image from shrinking */
}

.blog-post-card .post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-post-card:hover .post-image {
    transform: scale(1.05);
}

.blog-post-card .post-content {
    padding: var(--spacing-md);
    flex-grow: 1; /* Allows content to take up remaining space */
    display: flex;
    flex-direction: column;
}

.blog-post-card .post-category {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
}

.blog-post-card .post-title {
    font-size: var(--font-size-h4);
    margin-bottom: var(--spacing-xs);
    color: var(--heading-color);
    /* Truncate title to 2 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-post-card .post-excerpt {
    font-size: var(--font-size-sm);
    color: var(--secondary-color);
    margin-bottom: var(--spacing-md);
    flex-grow: 1; /* Allows excerpt to take up variable height */
    /* Truncate excerpt to 3 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-post-card .post-meta {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
    color: var(--secondary-color);
    margin-top: auto; /* Pushes meta to the bottom */
    padding-top: var(--spacing-xs);
    border-top: 1px solid var(--border-color);
}

/* --- Sidebar --- */
.sidebar {
    grid-column: 2 / 3; /* Occupy second column */
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.sidebar-module {
    background-color: var(--card-background);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-sm);
}

.sidebar-module h3 {
    font-size: var(--font-size-h4);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-xs);
}

.sidebar-module ul {
    margin-bottom: var(--spacing-sm);
}

.sidebar-module li {
    margin-bottom: 5px; /* Smaller gap for list items */
}

.sidebar-module li a {
    color: var(--text-color);
    display: block;
    padding: 2px 0;
}

.sidebar-module li a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.newsletter-form input[type="email"] {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    width: 100%;
}

.newsletter-form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.newsletter-form .btn-secondary {
    width: 100%;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--heading-color); /* Dark background */
    color: #f8f9fa; /* Light text */
    padding: var(--spacing-xl) 0 var(--spacing-md) 0;
    font-size: var(--font-size-sm);
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.footer-col h3 {
    color: #fff;
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-h4);
}

.footer-col p {
    margin-bottom: var(--spacing-xs);
    opacity: 0.8;
}

.footer-col ul {
    margin: 0;
}

.footer-col li {
    margin-bottom: 5px;
}

.footer-col a {
    color: #d1d8df; /* Slightly lighter than body text */
    text-decoration: none;
}

.footer-col a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.social-links {
    margin-top: var(--spacing-sm);
    display: flex;
    gap: var(--spacing-sm);
}

.social-links img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 4px;
    transition: background-color 0.2s ease;
}

.social-links img:hover {
    background-color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
    opacity: 0.7;
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .site-header .container {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    .main-nav {
        width: 100%;
    }
    .main-nav ul {
        justify-content: center;
    }
    .search-bar {
        width: 100%;
        justify-content: center;
    }
    .search-bar input[type="search"] {
        width: calc(100% - 80px); /* Adjust width to make room for the search button */
    }

    .content-wrapper {
        grid-template-columns: 1fr; /* Stack posts and sidebar */
        gap: var(--spacing-xl);
    }
    .blog-posts-section, .sidebar {
        grid-column: 1 / -1; /* Make them span full width */
    }

    .hero-title {
        font-size: var(--font-size-h2);
    }
    .hero-excerpt {
        font-size: var(--font-size-base);
    }

    .footer-columns {
        grid-template-columns: 1fr; /* Stack footer columns */
        text-align: center;
    }
    .social-links {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    h1 { font-size: var(--font-size-h2); }
    h2 { font-size: var(--font-size-h3); }
    h3 { font-size: var(--font-size-h4); }
    .hero-section {
        height: 500px;
    }
    .main-nav ul {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    .main-nav li {
        flex-basis: 45%; /* Two items per row */
        text-align: center;
    }
    .blog-posts-grid {
        grid-template-columns: 1fr; /* Single column for blog cards */
    }
}

@media (max-width: 480px) {
    .hero-section {
        height: 400px;
    }
    .hero-title {
        font-size: var(--font-size-h3);
    }
    .hero-excerpt {
        font-size: var(--font-size-sm);
    }
    .search-bar input[type="search"] {
        width: 100%;
    }
    .search-bar button {
        flex-shrink: 0;
        width: 70px; /* Give button a fixed width if input is 100% */
    }
    .search-bar {
        flex-wrap: wrap;
    }
}
