:root {
    --bg-dark: #1E1E1E;
    --prudent-red: #DD221B;
    --border-light: #F6F6F6;
    --font-primary: 'Neue Haas Grotesk Display Pro', 'Inter', sans-serif;
}

body.blogs-page-body {
    background-color: #fff;
    margin: 0;
    font-family: var(--font-primary);
}

.main-container {
    width: 1400px;
    margin: 0 auto;
}

/* HERO HEADER */
.blog-hero-header {
    background-color: var(--bg-dark);
    color: #fff;
    padding: 45px 0;
}

.blog-hero-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.blog-hero-text h1 { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.blog-hero-text p { color: #F6F6F6; font-size: 14px; max-width: 650px; line-height: 1.4; font-weight: 500;  }

.blog-hero-stats { display: flex; gap: 50px; }
.blog-stat { text-align: center; }
.blog-stat .v { display: block; font-size: 24px; font-weight: 800; }
.blog-stat .v-red { display: block; font-size: 24px; font-weight: 800; color: var(--prudent-red); }
.blog-stat .l { font-size: 11px; font-weight: 700; color: #666; margin-top: 5px; }

/* FILTERS */
.blog-main-content { padding-top: 35px; padding-bottom: 60px; }
.blog-filters { display: flex; gap: 12px; margin-bottom: 40px; }
.b-pill {
    padding: 10px 24px;
    border: 1px solid #111;
    background: transparent;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.b-pill.active { color: var(--prudent-red); border-color: var(--prudent-red); }

/* FEATURED CARDS (690px x 276px) */
.blog-featured-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.featured-card {
    width: 100%;
    max-width: 690px;
    min-height: 290px;
    display: flex;
    gap: 20px;
    padding: 20px;
    border: 2px solid var(--border-light);
    border-radius: 5px;
    box-sizing: border-box;
}

.f-img-area { width: 307px; height: 249px; position: relative; flex-shrink: 0; }
.f-img-area img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.f-badge {
    position: absolute; top: 10px; left: 10px;
    background: #fff; color: var(--prudent-red);
    font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 3px;
}

.f-text-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.f-cat {
    font-size: 13px;
    font-weight: 800;
    color: var(--prudent-red);
    margin-bottom: 10px;
    text-transform: uppercase;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.f-cat.env { color: #16a34a; }

.f-text-area h2 { font-size: 18px; font-weight: 800; margin-bottom: 10px; line-height: 1.3; color: #111; }
.f-text-area h2 a { color: inherit; text-decoration: none; }
.f-excerpt {
    font-size: 13px;
    color: #444;
    line-height: 1.2;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.f-quote {
    background-color: #F9F9F9;
    padding: 10px 12px;
    font-style: italic;
    font-size: 13px;
    color: #555;
    border-left: 2px solid #EEE;
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.f-author { margin-top: auto; }
.f-author strong { font-size: 13px; display: block; color: #111; }
.f-author span { font-size: 11px; color: #888; }

/* STANDARD GRID (335px x auto) */
.blog-standard-grid {
    display: grid;
    grid-template-columns: repeat(4, 335px);
    gap: 20px;
}

.s-card { width: 335px; border-radius: 5px; }
.s-img { width: 335px; height: 190px; margin-bottom: 15px; overflow: hidden; border-radius: 5px; background: #eee; }
.s-img img { width: 100%; height: 100%; object-fit: cover; }

.s-cat { font-size: 12px; font-weight: 800; color: var(--prudent-red); display: block; margin-bottom: 10px; }
.s-cat.soc { color: #9333ea; }
.s-cat.cul { color: #ea580c; }

.s-card h3 { font-size: 17px; font-weight: 800; line-height: 1.3; margin-bottom: 10px; color: #111; min-height: 44px; }
.s-card p { font-size: 14px; color: #666; line-height: 1.5; margin-bottom: 15px; }

.s-footer { border-top: 1px solid #F0F0F0; padding-top: 12px; }
.s-footer strong { font-size: 13px; display: block; color: #111; }
.s-footer span { font-size: 11px; color: #999; }

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 991px) {
    .main-container { width: 100% !important; padding: 0 20px; }
    .blog-hero-flex { flex-direction: column; text-align: center; gap: 30px; }
    .blog-hero-text p { max-width: 100%; }
    
    .blog-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 10px; }
    .b-pill { white-space: nowrap; }

    .blog-featured-row, .blog-standard-grid { grid-template-columns: 1fr; }
    
    .featured-card { 
        width: 100% !important; height: auto !important; 
        flex-direction: column; padding: 15px;
    }
    .f-img-area, .s-card, .s-img { width: 100% !important; }
    .f-img-area { height: 220px; }
}

/* --- STRICT CARD FIX (335px x 373px) --- */

.blog-standard-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 335px) !important;
    gap: 20px !important;
    width: 1400px !important;
    margin: 0 auto !important;
}

.s-card {
    width: 335px !important;
    height: 373px !important; /* Fixed height from Figma */
    background: #FFFFFF !important;
    border: 2px solid #F6F6F6 !important; /* 2px Border from Figma */
    border-radius: 5px !important;
    padding: 0 !important; /* Using internal box for padding control */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.s-card a {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    color: inherit !important;
    text-decoration: none !important;
}

.s-img-box {
    width: 307px!important;
    height: 173px !important; /* Fixed height for image area */
    overflow: hidden !important;
    align-items: center;
}

.s-img-box img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.s-info {
    padding: 15px 20px 20px 20px !important; /* Spacing from Figma */
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.s-cat {
    font-size: 11px !important;
    font-weight: 800 !important;
    color: var(--prudent-red);
    margin-bottom: 8px !important;
    text-transform: uppercase !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Specific category colors based on design */
.s-cat.soc { color: #9333ea !important; } /* Society Purple */
.s-cat.cul { color: #ea580c !important; } /* Culture Orange */
.s-cat.env { color: #16a34a !important; } /* Environment Green */

.s-card h3 {
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    color: #111 !important;
    margin: 0 0 10px 0 !important;
    /* Limit to 2 lines to preserve 373px height */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.s-card p {
    font-size: 13px !important;
    color: #666 !important;
    line-height: 1.5 !important;
    margin: 0 0 15px 0 !important;
    /* Limit lines to preserve footer position */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.s-footer {
    margin-top: auto !important; /* Pushes to bottom of 373px box */
    padding-top: 12px !important;
    border-top: 1px solid #F0F0F0 !important;
}

.s-footer strong {
    font-size: 13px !important;
    display: block !important;
    color: #111 !important;
    font-weight: 800 !important;
}

.s-footer span {
    font-size: 11px !important;
    color: #999 !important;
}

/* --- STRICT IMAGE BOX POSITIONING --- */

.s-img-box {
    width: 307px !important;
    height: 173px !important;
    overflow: hidden !important;
    
    /* Centering logic: margin-left/right auto centers it within the 335px card */
    /* margin-top: 14px provides the top padding/spacing you requested */
    margin: 14px auto 0 auto !important; 
    
    border-radius: 5px !important;
    display: block !important;
    position: relative !important;
}

.s-img-box img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* --- FINAL MOBILE RESPONSIVE FIX --- */

@media (max-width: 991px) {
    /* 1. Fix Background Color - Force white below the hero */
    body.blogs-page-body, 
    .blog-main-content,
    .main-container {
        background-color: #ffffff !important;
    }

    /* 2. Fix Grid Stacking - Change from fixed pixels to 1 column */
    .blog-featured-row, 
    .blog-standard-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 0 15px !important;
        gap: 30px !important;
    }

    /* 3. Fix Featured Cards (the 690px ones) */
    .featured-card {
        width: 100% !important;
        height: auto !important; /* Allow it to grow with content */
        flex-direction: column !important;
        padding: 15px !important;
    }

    .f-img-area {
        width: 100% !important;
        height: 220px !important; /* Fixed height for mobile thumbnail */
        margin-bottom: 15px !important;
    }

    /* 4. Fix Standard Cards (the 335px ones) */
    .s-card {
        width: 100% !important;
        height: auto !important; /* Remove the 373px fixed height */
        margin: 0 auto !important;
    }

    .s-img-box {
        width: 100% !important; /* Image box takes full card width on mobile */
        height: 200px !important;
        margin: 0 0 15px 0 !important; /* Remove the 'auto' centering margin */
    }

    /* 5. Clean up Typography for mobile */
    .f-text-area h2, .s-card h3 {
        font-size: 20px !important;
        -webkit-line-clamp: unset !important; /* Allow full title to show on mobile */
    }

    .f-excerpt, .s-card p {
        -webkit-line-clamp: unset !important; /* Allow full text to show on mobile */
        margin-bottom: 20px !important;
    }

    /* 6. Filter Pills - Horizontal Scroll fix */
    .blog-filters {
        padding: 15px 15px !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .b-pill {
        white-space: nowrap !important;
    }
}

/* --- STRICT HERO HEADER FIX FOR MOBILE --- */

@media (max-width: 991px) {
    /* 1. Force the Hero Background back to Dark (Override previous fixes) */
    .blog-hero-header {
        background-color: #1E1E1E !important;
        padding: 40px 0 !important;
        display: block !important;
    }

    /* 2. Prevent the inner container from turning white */
    .blog-hero-header .main-container {
        background-color: transparent !important;
        display: block !important;
    }

    /* 3. Force Title (h1) to show and stay White */
    .blog-hero-text h1 {
        display: block !important;
        visibility: visible !important;
        color: #FFFFFF !important;
        font-size: 26px !important;
        text-align: center !important;
        margin-bottom: 10px !important;
    }

    /* 4. Fix Hero Description and Stats Alignment */
    .blog-hero-text p {
        color: #AAAAAA !important; /* Lighter gray for readability on dark */
        text-align: center !important;
        margin-bottom: 30px !important;
        font-size: 14px !important;
        padding: 0 10px !important;
    }

    .blog-hero-flex {
        flex-direction: column !important;
        align-items: center !important;
    }

    .blog-hero-stats {
        justify-content: center !important;
        gap: 25px !important;
        width: 100% !important;
    }

    .blog-stat .l {
        color: #666666 !important;
    }
}


/* Hidden by default on Desktop */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 75px;
    background-color: #000000;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    display: none;
    /* Changed via media query */
    justify-content: space-around;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    padding: 0 10px;
}

/* Visibility Logic */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }

    /* Add padding to the bottom of the body so the nav doesn't hide content */
    body {
        padding-bottom: 75px;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #ffffff;
    font-family: "Neue Haas Grotesk Display Pro", sans-serif;
    transition: all 0.2s ease;
    flex: 1;
}

.nav-icon {
    width: 24px;
    height: 24px;
    fill: #ffffff;
    /* Default icon color */
    margin-bottom: 5px;
}

.nav-item span {
    font-size: 12px;
    font-weight: 700;
    /* Bold as per image */
    text-align: center;
}

/* Active State Styles */
.nav-item.active {
    color: #E11B22;
    /* Prudent Red */
}

.nav-item.active .nav-icon {
    fill: #E11B22;
    /* Active Icon Color */
}

/* Optional: Slight feedback when clicking */
.nav-item:active {
    transform: scale(0.92);
}