/* =========================================================
   Agriculture Home Page
   ========================================================= */

.agri-home {
    --agri-green: #126b3d;
    --agri-dark-green: #0b5831;
    --agri-blue: #1759d1;
    --agri-text: #10233d;
    --agri-muted: #607084;
    --agri-gutter: 22px;

    color: var(--agri-text);
    background: #f8fcfb;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.agri-home *,
.agri-home *::before,
.agri-home *::after {
    box-sizing: border-box;
}

.agri-home img {
    max-width: 100%;
}

/* =========================================================
   Container
   ========================================================= */

.agri-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--agri-gutter);
}

/* =========================================================
   Hero
   ========================================================= */

.agri-hero {
    padding: 24px 0 0 0;
    text-align: center;
    /* background: linear-gradient(135deg, #effcf5 0%, #edf9f7 48%, #eef5ff 100%); */
}

.agri-hero h1, h2 {
    margin: 0;
    color: var(--agri-green);
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.8px;
}

.hero-subtitle {
    margin: 8px 0 15px;
    color: var(--agri-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* =========================================================
   Category Cards
   ========================================================= */

.research-categories {
    padding: 20px 0;
    /* background: #f3fbf8; */
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.category-card {
    position: relative;
    display: block;
    height: 240px;
    overflow: hidden;
    border-radius: 11px;
    background-color: #d9e8e0; /* fallback while image loads / if missing */
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(20, 45, 50, 0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(20, 45, 50, 0.2);
}

.category-card:focus-visible {
    outline: 3px solid rgba(40, 124, 75, 0.45);
    outline-offset: 3px;
}

/* Image fills the whole card, behind the overlay and text */
.category-card > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.category-card:hover > img {
    transform: scale(1.05);
}

.category-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.08) 65%);
}

.category-content {
    position: absolute;
    left: 15px;
    right: 15px;
    bottom: 13px;
    color: #ffffff;
    text-align: center;
    
}

.category-number {
    display: block;
    margin-bottom: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.85;
    
    
}

.category-content h3 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}

/* =========================================================
   Featured Image
   ========================================================= */

.featured-image {
    margin: 20px auto;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.featured-image-1 {
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.featured-image-1 img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* =========================================================
   Featured Research
   ========================================================= */

.featured-research {
    padding: 0 0 40px;
    background: linear-gradient(180deg, #f3fbf8 0%, #f8fcfb 100%);
}

/* Make sure the hidden attribute always wins */
.featured-research[hidden] {
    display: none;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 18px;
}

.section-heading h2 {
    margin: 0;
    color: var(--agri-green);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
}

.view-all-research {
    flex-shrink: 0;
    color: var(--agri-blue);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.view-all-research:hover {
    text-decoration: underline;
}

/* =========================================================
   Research Grid + Cards
   ========================================================= */

.research-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.research-card {
    position: relative; /* anchor for the stretched link */
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.research-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.research-card:focus-within {
    outline: 3px solid rgba(40, 124, 75, 0.35);
    outline-offset: 3px;
}

/* Six card colours (cycled in the template with a modulo) */
.research-card-1 { background: #e8f5e9; border-top: 5px solid #388e3c; }
.research-card-2 { background: #e3f2fd; border-top: 5px solid #1976d2; }
.research-card-3 { background: #f3e5f5; border-top: 5px solid #8e44ad; }
.research-card-4 { background: #fff3e0; border-top: 5px solid #ef8c00; }
.research-card-5 { background: #fce4ec; border-top: 5px solid #d81b60; }
.research-card-6 { background: #e0f7fa; border-top: 5px solid #00838f; }

/* =========================================================
   Citation + link
   ========================================================= */

.gs-citation {
    color: #17251c;
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gs-citation em {
    font-style: italic;
}

.gs-links {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 13px;
    font-weight: 600;
}

.gs-links a {
    color: var(--agri-blue);
    text-decoration: none;
}

.gs-links a:hover {
    text-decoration: underline;
}

/* Stretched link: whole card is clickable */
.gs-links a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.gs-links a:focus-visible {
    outline: none;
}

/* =========================================================
   Empty State
   ========================================================= */

.research-empty {
    padding: 70px 25px;
    text-align: center;
    background: #f7f9f7;
    border: 1px solid #e1e7e3;
    border-radius: 10px;
}

.research-empty h3 {
    margin: 0 0 8px;
    color: #17251c;
    font-size: 22px;
}

.research-empty p {
    margin: 0;
    color: #737c76;
    font-size: 14px;
}

/* =========================================================
   Tablet (900px)
   ========================================================= */

@media (max-width: 900px) {
    .research-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================
   Mobile (600px)
   ========================================================= */

@media (max-width: 600px) {
    .agri-home {
        --agri-gutter: 16px;
    }

    .agri-hero {
        padding: 15px 0 0 0;
    }

    .agri-hero h1 {
        font-size: 28px;
    }
    .research-categories {
        padding: 20px 0;
    }

    .hero-subtitle {
        font-size: 12px;
        padding: 0 15px;
    }

    .category-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .category-card {
        height: 150px;
    }

    .research-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .research-card {
        padding: 16px 18px;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .section-heading h2 {
        font-size: 20px;
    }
}

/* =========================================================
   Small Mobile (360px)
   ========================================================= */

@media (max-width: 360px) {
    .agri-home {
        --agri-gutter: 12px;
    }

    .agri-hero h1 {
        font-size: 25px;
    }

    .category-card {
        height: 140px;
    }
}

/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .agri-home *,
    .agri-home *::before,
    .agri-home *::after {
        transition: none !important;
    }

    .category-card:hover,
    .category-card:hover > img,
    .research-card:hover {
        transform: none;
    }
}