/* style/blog.css */

/* Base styles for the blog page, ensuring text contrast with the body background */
/* Assuming body background is light (white/light gray) from shared.css var(--background-color) */
.page-blog {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333333; /* Deep gray for readability on light backgrounds */
    background-color: transparent; /* Inherit from body, or ensure no conflict */
}

/* Hero Section */
.page-blog__hero-section {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column; /* Image above content */
    align-items: center;
    padding: 60px 20px;
    padding-top: 10px; /* Small top padding, body handles header offset */
    background-color: #26A9E0; /* Brand primary color for dark section */
    color: #ffffff; /* White text on brand color background */
    text-align: center;
    overflow: hidden; /* Ensure no overflow */
}

.page-blog__hero-image-wrapper {
    width: 100%;
    max-width: 1200px; /* Constrain image width */
    margin-bottom: 30px; /* Space between image and content */
}

.page-blog__hero-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.page-blog__hero-content {
    max-width: 900px;
    margin: 0 auto;
}

.page-blog__hero-title {
    font-size: clamp(2.2rem, 4vw, 3.5rem); /* Responsive H1 font size */
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.page-blog__hero-description {
    font-size: 1.15rem;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    color: #f0f0f0;
}

.page-blog__hero-cta {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
}

/* General button styles */
.page-blog__btn-primary,
.page-blog__btn-secondary {
    display: inline-block;
    padding: 14px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    max-width: 100%; /* Ensure buttons don't overflow */
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word; /* Break long words */
}

.page-blog__btn-primary {
    background-color: #EA7C07; /* Login/CTA color */
    color: #ffffff;
    border: 2px solid #EA7C07;
}

.page-blog__btn-primary:hover {
    background-color: #d16b06;
    border-color: #d16b06;
}

.page-blog__btn-secondary {
    background-color: #ffffff;
    color: #26A9E0; /* Primary brand color */
    border: 2px solid #26A9E0;
}

.page-blog__btn-secondary:hover {
    background-color: #f0f0f0;
    color: #1e87bb;
    border-color: #1e87bb;
}

.page-blog__btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

/* Container for content sections */
.page-blog__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Section Titles */
.page-blog__section-title {
    font-size: 2.5rem;
    color: #26A9E0; /* Primary brand color */
    text-align: center;
    margin-bottom: 40px;
    font-weight: 700;
}

/* Latest Posts Section */
.page-blog__latest-posts {
    padding: 80px 0;
    background-color: #ffffff; /* Light background for contrast */
    color: #333333;
}

.page-blog__posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.page-blog__post-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure cards have equal height */
}

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

.page-blog__post-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

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

.page-blog__post-title {
    font-size: 1.3rem;
    color: #26A9E0;
    padding: 15px 20px 5px;
    margin: 0;
}

.page-blog__post-meta {
    font-size: 0.9rem;
    color: #777777;
    padding: 0 20px;
    margin-bottom: 10px;
}

.page-blog__post-excerpt {
    font-size: 1rem;
    color: #555555;
    padding: 0 20px 15px;
    flex-grow: 1; /* Allow excerpt to take available space */
}

.page-blog__read-more {
    display: inline-block;
    color: #EA7C07; /* Login/CTA color */
    text-decoration: none;
    font-weight: bold;
    padding: 0 20px 20px;
}

.page-blog__read-more:hover {
    text-decoration: underline;
}

.page-blog__view-all-button {
    text-align: center;
    margin-top: 40px;
}

/* Categories Section */
.page-blog__categories-section {
    padding: 80px 0;
    background-color: #26A9E0; /* Primary brand color for dark section */
    color: #ffffff;
}

.page-blog__categories-section .page-blog__section-title {
    color: #ffffff; /* White title on brand color background */
}

.page-blog__categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    justify-content: center;
}

.page-blog__category-card {
    background-color: rgba(255, 255, 255, 0.1); /* Semi-transparent white on brand color */
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: #ffffff;
    transition: background-color 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

.page-blog__category-card:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

.page-blog__category-icon {
    width: 100px; /* Fixed size for category icons */
    height: 100px;
    object-fit: contain;
    margin-bottom: 15px;
    display: block;
    max-width: 100%; /* Ensure icon doesn't overflow */
    height: auto;
}

.page-blog__category-name {
    font-size: 1.2rem;
    font-weight: bold;
}

/* FAQ Section */
.page-blog__faq-section {
    padding: 80px 0;
    background-color: #f8f8f8; /* Light gray background */
    color: #333333;
}

.page-blog__faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.page-blog__faq-item {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.page-blog__faq-item summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #26A9E0;
    cursor: pointer;
    list-style: none; /* Remove default marker */
}

.page-blog__faq-item summary::-webkit-details-marker {
    display: none; /* Remove default marker for Webkit browsers */
}

.page-blog__faq-qtext {
    flex-grow: 1;
}

.page-blog__faq-toggle {
    font-size: 1.5rem;
    line-height: 1;
    margin-left: 15px;
    transition: transform 0.3s ease;
}

.page-blog__faq-item[open] .page-blog__faq-toggle {
    transform: rotate(45deg); /* Rotate plus to form an X */
}

.page-blog__faq-answer {
    padding: 0 25px 20px;
    font-size: 1rem;
    color: #555555;
}

/* CTA Banner Section */
.page-blog__cta-banner {
    padding: 80px 20px;
    background-color: #26A9E0; /* Primary brand color for dark section */
    color: #ffffff;
    text-align: center;
}

.page-blog__cta-banner .page-blog__cta-title {
    font-size: 2.8rem;
    color: #ffffff;
    margin-bottom: 20px;
}

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

/* Responsive adjustments */
@media (max-width: 1024px) {
    .page-blog__hero-title {
        font-size: clamp(2rem, 5vw, 3rem);
    }
    .page-blog__section-title {
        font-size: 2rem;
    }
    .page-blog__cta-banner .page-blog__cta-title {
        font-size: 2.2rem;
    }
}

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

    .page-blog__hero-section {
        padding: 40px 15px;
        padding-top: 10px !important; /* Ensure small top padding */
    }

    .page-blog__hero-image-wrapper {
        margin-bottom: 20px;
    }

    .page-blog__hero-title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }

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

    .page-blog__hero-cta {
        flex-direction: column; /* Stack buttons vertically on mobile */
        gap: 15px;
    }

    /* All images must be responsive on mobile */
    .page-blog img {
        max-width: 100% !important;
        width: 100% !important; /* Explicitly set width to 100% */
        height: auto !important;
        display: block !important;
    }

    /* All image containers must be responsive on mobile */
    .page-blog__hero-image-wrapper,
    .page-blog__post-card,
    .page-blog__category-card,
    .page-blog__container {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 15px;
        padding-right: 15px;
        overflow: hidden !important; /* Prevent overflow from children */
    }

    /* All buttons must be responsive on mobile */
    .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;
    }
    
    .page-blog__hero-cta {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 15px;
        padding-right: 15px;
        flex-wrap: wrap !important;
        gap: 10px;
    }

    .page-blog__section-title {
        font-size: 1.8rem;
    }

    .page-blog__posts-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }

    .page-blog__post-thumbnail {
        height: 180px; /* Adjust height for mobile */
    }

    .page-blog__categories-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }

    .page-blog__category-card {
        min-height: 150px;
    }

    .page-blog__faq-item summary {
        padding: 15px 20px;
        font-size: 1rem;
    }

    .page-blog__faq-answer {
        padding: 0 20px 15px;
    }

    .page-blog__cta-banner {
        padding: 50px 15px;
    }

    .page-blog__cta-banner .page-blog__cta-title {
        font-size: 1.8rem;
    }

    .page-blog__cta-banner .page-blog__cta-description {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .page-blog__hero-section {
        padding: 30px 10px;
        padding-top: 10px !important;
    }
    .page-blog__hero-title {
        font-size: clamp(1.5rem, 8vw, 2rem);
    }
    .page-blog__btn-primary,
    .page-blog__btn-secondary {
        font-size: 0.9rem;
        padding: 12px 25px;
    }
    .page-blog__section-title {
        font-size: 1.5rem;
    }
    .page-blog__cta-banner .page-blog__cta-title {
        font-size: 1.6rem;
    }
}

/* Ensure no filter is applied to images */
.page-blog img {
    filter: none;
}