/* style/blog.css */

/* Variables and root styles for color contrast safety - these would ideally be in shared.css but are included for robustness */
:root {
    --page-blog-primary-color: #C91F17;
    --page-blog-secondary-color: #E53935;
    --page-blog-text-main: #FFF5E1; /* Custom text color for specific sections */
    --page-blog-card-bg: #D32F2F; /* Custom card background */
    --page-blog-background: #B71C1C; /* Custom section background */
    --page-blog-border-color: #F2B544;
    --page-blog-glow-color: #FFCC66;
    --page-blog-gold-color: #F4D34D;
    --page-blog-deep-red-color: #7A0E0E;

    /* Fallback for body background, assuming a dark background from shared.css */
    --body-text-color: #ffffff; 
    --body-link-color: #F4D34D; /* Gold for links */
    --body-link-hover-color: #FFCC66; /* Glow on hover */
}

/* Base styles for the blog page, assuming a dark body background from shared.css */
.page-blog {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--body-text-color); /* Default text color for the page content, contrasting with shared body background */
    background-color: transparent; /* Body handles the main background */
}

.page-blog__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Links within the blog content */
.page-blog a {
    color: var(--body-link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.page-blog a:hover {
    color: var(--body-link-hover-color);
    text-decoration: underline;
}

/* Hero Section */
.page-blog__hero-section {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column; /* Image above content */
    align-items: center;
    padding: 60px 20px; /* General padding */
    padding-top: 10px; /* Small top padding, body handles header offset */
    background-color: var(--page-blog-deep-red-color); /* Dark background for the hero section */
    color: #ffffff; /* White text for hero section */
}

.page-blog__hero-image-wrapper {
    width: 100%;
    max-width: 1200px;
    margin-bottom: 30px; /* Space between image and text */
    border-radius: 10px;
    overflow: hidden;
}

.page-blog__hero-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.page-blog__hero-content {
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
    box-sizing: border-box;
}

.page-blog__hero-title {
    font-size: 2.5em; /* Use relative units, not fixed large values */
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    color: var(--page-blog-gold-color); /* Gold for H1 */
}

.page-blog__hero-description {
    font-size: 1.1em;
    margin-bottom: 30px;
    color: #f0f0f0;
}

/* Buttons */
.page-blog__btn-primary,
.page-blog__btn-secondary {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    max-width: 100%; /* Ensure responsiveness */
    white-space: normal; /* Allow text wrapping */
    word-wrap: break-word; /* Allow long words to break */
}

.page-blog__btn-primary {
    background: linear-gradient(180deg, #FFD86A 0%, #E6B800 100%); /* Custom button color */
    color: var(--page-blog-deep-red-color); /* Deep red text for contrast */
    border: none;
    margin: 0 10px;
}

.page-blog__btn-primary:hover {
    background: linear-gradient(180deg, #FFDD77 0%, #F0C000 100%);
    box-shadow: 0 0 15px var(--page-blog-glow-color);
}

.page-blog__btn-secondary {
    background: transparent;
    color: var(--page-blog-gold-color);
    border: 2px solid var(--page-blog-gold-color);
    margin: 0 10px;
}

.page-blog__btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: #ffffff;
}

/* Latest Posts Section */
.page-blog__latest-posts {
    padding: 80px 0;
    background-color: #1a1a1a; /* Dark background for this section */
    color: #ffffff;
}

.page-blog__section-title {
    text-align: center;
    font-size: 2.2em;
    margin-bottom: 50px;
    color: var(--page-blog-gold-color);
    font-weight: 700;
}

.page-blog__post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.page-blog__post-card {
    background-color: var(--page-blog-card-bg); /* Custom card background */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: var(--page-blog-text-main); /* Custom text color for cards */
}

.page-blog__post-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.page-blog__post-link {
    display: block;
    text-decoration: none;
    color: inherit; /* Inherit text color from parent card */
}

.page-blog__post-image {
    width: 100%;
    height: 225px; /* Fixed height for consistency */
    object-fit: cover;
    display: block;
}

.page-blog__post-content {
    padding: 25px;
}

.page-blog__post-title {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: var(--page-blog-gold-color);
    line-height: 1.3;
}

.page-blog__post-meta {
    font-size: 0.9em;
    color: #ccc;
    margin-bottom: 15px;
}

.page-blog__post-excerpt {
    font-size: 1em;
    color: #f0f0f0;
}

/* Call to Action Section */
.page-blog__cta-section {
    padding: 80px 20px;
    text-align: center;
    background-color: var(--page-blog-background); /* Custom section background */
    color: var(--page-blog-text-main); /* Custom text color */
}

.page-blog__cta-title {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: var(--page-blog-gold-color);
    font-weight: 700;
}

.page-blog__cta-description {
    font-size: 1.2em;
    max-width: 900px;
    margin: 0 auto 40px auto;
    color: #f0f0f0;
}

.page-blog__cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%; /* Ensure container takes full width */
    max-width: 100%; /* Ensure container takes full width */
    box-sizing: border-box;
    overflow: hidden; /* Prevent overflow */
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .page-blog__hero-title {
        font-size: 2em;
    }
    .page-blog__section-title,
    .page-blog__cta-title {
        font-size: 2em;
    }
    .page-blog__post-title {
        font-size: 1.2em;
    }
}

@media (max-width: 768px) {
    .page-blog {
        font-size: 16px;
        line-height: 1.6;
    }

    .page-blog__hero-section {
        padding: 40px 15px;
        padding-top: 10px !important; /* Small top padding, body handles header offset */
    }

    .page-blog__hero-title {
        font-size: 1.8em;
    }

    .page-blog__hero-description {
        font-size: 1em;
    }

    .page-blog__latest-posts,
    .page-blog__cta-section {
        padding: 50px 0;
    }

    .page-blog__container {
        padding: 0 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .page-blog__section-title,
    .page-blog__cta-title {
        font-size: 1.8em;
        margin-bottom: 30px;
    }

    .page-blog__post-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .page-blog__post-image {
        height: 180px; /* Adjusted height for mobile cards */
    }

    /* All images must adapt to screen width */
    .page-blog img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        display: block !important;
    }

    /* All image containers must adapt to screen width */
    .page-blog__hero-image-wrapper,
    .page-blog__post-card {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* All buttons must adapt to screen width */
    .page-blog__btn-primary,
    .page-blog__btn-secondary,
    .page-blog a[class*="button"],
    .page-blog a[class*="btn"] {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Button containers for multiple buttons */
    .page-blog__cta-buttons {
        flex-direction: column !important;
        gap: 15px !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 15px;
        overflow: hidden !important;
    }
}

@media (max-width: 480px) {
    .page-blog__hero-title {
        font-size: 1.5em;
    }
    .page-blog__section-title,
    .page-blog__cta-title {
        font-size: 1.5em;
    }
    .page-blog__post-content {
        padding: 15px;
    }
    .page-blog__post-title {
        font-size: 1.1em;
    }
}

/* Ensure content area text is readable */
.page-blog__content-area p,
.page-blog__content-area li {
    color: #f0f0f0; /* Light text for readability on dark backgrounds */
}

/* Contrast fixes for specific elements if needed, based on smart color logic */
/* The .page-blog__cta-section uses --page-blog-background which is #B71C1C, a dark red. */
/* Text color for this section is --page-blog-text-main: #FFF5E1, which provides good contrast. */
/* The .page-blog__post-card uses --page-blog-card-bg: #D32F2F, a dark red. */
/* Text color for cards is --page-blog-text-main: #FFF5E1, which provides good contrast. */