/* Posts Grid Section Styles */
.posts-grid-section {
    --grid-bg: #F8F9FA;
    --grid-text: #333333;
    --grid-accent: #F5A623;
    --grid-border-radius: 12px;
    --grid-gap: clamp(1rem, 3vw, 1.5rem);
    position: relative;
    padding: clamp(1rem, 3vw, 1.5rem) clamp(1rem, 3vw, 1.5rem);
    background-color: var(--grid-bg);
    color: var(--grid-text);
}

.posts-grid-container {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: var(--grid-gap);
    width: 88%;
    margin: 0 auto;
    align-items: stretch; /* Ensure grid items stretch to equal height */
}

/* Post Grid Item */
.post-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(0.8rem, 2vw, 1rem);
    height: 100%; /* Ensure full height of grid cell */
}

.post-grid-image {
    width: 100%;
    max-width: clamp(200px, 80vw, 400px);
    aspect-ratio: 4 / 3; /* As set previously */
    border-left: 5px solid #A3CF52;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.6);
    background: linear-gradient(135deg, rgba(245, 166, 35, 0.1), rgba(0, 0, 0, 0.2));
    overflow: hidden;
    margin: 0 auto; /* Center the image */
}

.post-grid-image img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    border-radius: calc(var(--grid-border-radius) - 1rem);
}

/* Post Grid Title */
.post-grid-title {
    text-align: center;
    margin: clamp(0.8rem, 2vw, 1rem) 0;
    width: 100%;
    max-width: clamp(200px, 80vw, 400px);
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute space: top hr, h3, bottom hr */
    align-items: center; /* Center content horizontally */
    flex-grow: 1; /* Ensure it grows to match tallest in row */
    min-height: 100px; /* Optional: Ensure enough space for alignment */
}

/* Post Grid Title H3 */
.post-grid-title h3 {
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    font-weight: 600;
    text-align: left;
    margin: 0; /* Remove margin to let flexbox handle spacing */
    line-height: 1.3;
    width: 100%;
    flex-grow: 1; /* Allow h3 to take available space */
    display: flex;
    align-items: center; /* Vertically center the text within its space */
}

/* Separator Line */
.separator-line {
    background: white;
    margin: 0; /* Remove margin to let flexbox position it */
    width: 100%;
    height: 1px; /* Ensure consistent thickness */
}

.post-grid-description {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-family: 'GothamLight';
    text-align: left;
    margin: 0;
    flex-grow: 1; /* Allow description to grow and fill space */
    line-height: 1.6;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 4.8em;
    width: 100%;
    max-width: clamp(200px, 80vw, 400px);
}

.post-grid-read-more {
    text-align: center;
    width: 100%;
    max-width: clamp(200px, 80vw, 400px);
    margin: 2rem 0rem;
}

.read-more-link {
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: clamp(0.3rem, 1vw, 0.5rem) 0;
    border-radius: 5px;
    justify-content: space-between;
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
}

.read-more-link:hover {
    color: #A3CF52 !important;
}

.read-more-link .arrow {
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: transform 0.3s ease;
}

.read-more-link i.fa-solid.fa-arrow-right {
    margin-left: 8px;
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 900;
    vertical-align: middle;
    transition: transform 0.3s ease;
}

.read-more-link:hover i.fa-solid.fa-arrow-right {
    transform: translateX(5px);
}

.read-more-link:hover .arrow {
    transform: translateX(5px);
}

/* Pagination Styles */
.posts-grid-pagination {
    text-align: center;
    margin: clamp(1.5rem, 3vw, 2rem) auto 0;
    width: 90%;
    max-width: clamp(200px, 80vw, 1200px);
}

.posts-grid-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: clamp(0.5rem, 1.5vw, 0.75rem);
    flex-wrap: wrap;
    justify-content: center;
}

.posts-grid-pagination li {
    display: inline-block;
}

.posts-grid-pagination a,
.posts-grid-pagination .current {
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 600;
    text-decoration: none;
    color: #A3CF52; /* Green for default state */
    background-color: transparent;
    padding: clamp(0.4rem, 1vw, 0.6rem) clamp(0.6rem, 1.5vw, 0.8rem);
    border: 1px solid #A3CF52; /* Green border */
    border-radius: var(--grid-border-radius);
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
    line-height: 1.5;
}

.posts-grid-pagination a:hover,
.posts-grid-pagination a:focus {
    color: var(--grid-accent); /* Orange on hover/focus */
    border-color: var(--grid-accent); /* Orange border */
    background-color: rgba(245, 166, 35, 0.1); /* Subtle orange background */
    transform: translateY(-2px);
}

.posts-grid-pagination .current {
    color: #fff; /* White text */
    background-color: #A3CF52; /* Green background for current */
    border-color: #A3CF52; /* Green border */
    cursor: default;
}

.posts-grid-pagination a:focus {
    outline: 2px solid var(--grid-accent); /* Orange outline for accessibility */
    outline-offset: 2px;
}

/* Responsive Styles */
@media (min-width: 1024px) and (max-width: 1400px) {
	.posts-grid-container {
        grid-template-columns: repeat(3, 1fr); /* 3 columns for this range */
    }

    .post-grid-item {
        width: 100%;
    }

    .post-grid-image {
        max-width: clamp(180px, 45vw, 350px);
    }

    .post-grid-title h3 {
        font-size: clamp(1.1rem, 2.2vw, 1.3rem);
    }

    .post-grid-description {
        font-size: clamp(0.85rem, 1.8vw, 1rem);
    }

    .posts-grid-pagination {
        margin: clamp(1rem, 2.5vw, 1.5rem) auto 0;
    }

    .posts-grid-pagination a,
    .posts-grid-pagination .current {
        font-size: clamp(0.85rem, 1.8vw, 0.95rem);
        padding: clamp(0.3rem, 0.8vw, 0.5rem) clamp(0.5rem, 1.2vw, 0.7rem);
    }

    .post-grid-title {
        min-height: 90px;
    }
	
}
/* Responsive Styles */
@media (max-width: 1023px) {
    .posts-grid-container {
        grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columns */
    }

    .post-grid-item {
        width: 100%;
    }

    .post-grid-image {
        max-width: clamp(180px, 45vw, 350px); /* Slightly smaller images for tablet */
    }
	
	.post-grid-title {
        min-height: 90px; /* Adjust for smaller screens */
    }

    .post-grid-title h3 {
        font-size: clamp(1.1rem, 2.2vw, 1.3rem); /* Slightly smaller font for tablet */
    }

    .post-grid-description {
        font-size: clamp(0.85rem, 1.8vw, 1rem);
    }
	
	.posts-grid-pagination {
        margin: clamp(1rem, 2.5vw, 1.5rem) auto 0;
    }

    .posts-grid-pagination a,
    .posts-grid-pagination .current {
        font-size: clamp(0.85rem, 1.8vw, 0.95rem);
        padding: clamp(0.3rem, 0.8vw, 0.5rem) clamp(0.5rem, 1.2vw, 0.7rem);
    }
}

.post-grid-image img[src*="Rockstead-Ltd-logo-w-rgb-300x46.png"] {
    aspect-ratio: auto; /* Respect logo's natural aspect ratio */
    height: auto !important; /* Allow natural height */
    width: 85%; /* Keep specified width */
    object-fit: contain; /* Show full logo without cropping */
    padding: 0.5rem; /* Maintain padding */
    display: block; /* Ensure block-level for centering */
    margin: 0 auto; /* Center horizontally */
    position: relative; /* Ensure proper positioning */
    top: 50%; /* Center vertically */
    transform: translateY(-50%); /* Offset by half its height */
}

@media (max-width: 767px) {
    .posts-grid-section {
        padding: clamp(0.5rem, 2vw, 1rem) clamp(0.5rem, 2vw, 1rem);
    }

    .posts-grid-container {
        grid-template-columns: 1fr; /* Mobile: 1 column */
    }

    .post-grid-image {
        max-width: clamp(200px, 80vw, 400px); /* Larger images for mobile */
    }

    .post-grid-title h3 {
        font-size: clamp(1rem, 2vw, 1.2rem);
    }

    .post-grid-description {
        font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    }

	.post-grid-title {
        min-height: 80px; /* Adjust for mobile */
    }
	.posts-grid-pagination {
        margin: clamp(0.8rem, 2vw, 1.2rem) auto 0;
    }

    .posts-grid-pagination a,
    .posts-grid-pagination .current {
        font-size: clamp(0.8rem, 1.8vw, 0.9rem);
        padding: clamp(0.25rem, 0.7vw, 0.4rem) clamp(0.4rem, 1vw, 0.6rem);
    }
}

