/*
  Page-specific stylesheet for Resources Page
  Version: 2.2 - "The Definitive Knowledge Hall"
*/

/* --- 1. Hero & CTA Background Unification --- */
.page-hero,
.final-cta-section {
    /* ★ MODIFIED: Using a more suitable and unified background image ★ */
    background-image: linear-gradient(rgba(0, 0, 0, .5), rgba(0, 0, 0, .5)), url(../images/backgrounds/bg-knowledge-hall.jpg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* --- 2. Main Content Layout (Sidebar on Right) --- */
.resources-main-section {
    padding: var(--section-padding);
    background-color: var(--color-light-grey);
}

.resources-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 992px) {
    .resources-layout {
        grid-template-columns: 1fr 240px;
    }

    .resources-sidebar {
        grid-column: 2 / 3;
    }

    .posts-main-area {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
}

/* --- 3. Sidebar & Filters --- */
.resources-sidebar {
    width: 100%;
}

.sidebar-sticky-content {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.category-filters {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.filter-btn {
    background: none;
    border: none;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-secondary);
    cursor: pointer;
    transition: color 0.3s ease, background-color 0.3s ease;
    border-radius: 6px;
    width: 100%;
    text-align: left;
}

.filter-btn:hover {
    color: var(--color-primary);
    background-color: #e9f2ff;
}

.filter-btn.is-active {
    color: var(--color-primary);
    font-weight: 700;
    background-color: #e9f2ff;
}

/* --- 4. ★ REBUILT: Classic "Left-Image, Right-Text" Post List --- */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* A single column for the list */
    gap: 2rem;
}

.post-card {
    position: relative;
    /* ★ ADD THIS LINE ★ */
    background-color: var(--color-light);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;

    /* Animation for smooth loading */
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.post-card-image-link {
    flex-shrink: 0;
    width: 180px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    /* ★ ADDED: Required for the badge positioning */
}

/* ★ ADD THIS NEW, REFINED RULE ★ */
.post-card.is-featured::before {
    content: 'FEATURED';
    position: absolute;
    /* Position it relative to the card, not the image */
    top: 5px;
    /* Pulls the badge upwards, outside the card's normal flow */
    right: 28px;
    /* Aligns with the content's padding */
    background-color: var(--color-primary);
    color: var(--color-light);
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 6px;
    z-index: 3;
    /* Ensures the badge is on top of everything */
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.2);
    /* Adds a subtle glow */
}

.post-card-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-image-link img {
    transform: scale(1.05);
}

.post-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-category {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    /* Reduced margin */
}

.post-card-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.post-card-content h3 a {
    transition: color 0.3s ease;
}

.post-card-content h3 a:hover {
    color: var(--color-primary);
}

/* Excerpt added for context */
.post-excerpt {
    font-size: 0.95rem;
    color: var(--color-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    /* Truncate long excerpts */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-clamp: 2;
}

.post-card-meta {
    font-size: 0.85rem;
    color: var(--color-secondary);
    margin-top: auto;
    /* Pushes meta to the bottom */
}


/* --- 5. Load More Button --- */
.load-more-container {
    padding-top: 3rem;
    /* Reduced padding */
    text-align: center;
}

#load-more-btn {
    padding: 14px 32px;
    font-size: 1.1rem;
}