/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
    /* Premium Color Palette - Agroecology & Humanity */
    --primary: #2E5C38;
    /* Deep Forest Green */
    --primary-dark: #1F4027;
    --primary-light: #4A8C5A;
    --secondary: #D4A373;
    /* Earthy Sand */
    --accent: #E9C46A;
    /* Golden Sun */
    --text-dark: #1D1D1D;
    --text-light: #555555;
    --bg-light: #F9FDF9;
    /* Very subtle green tint */
    --white: #FFFFFF;
    --danger: #E76F51;

    /* Spacing & Layout */
    --container-width: 1200px;
    --header-height: 70px;
    /* Slight increase for better touch targets */

    /* Effects */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
    height: auto;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

/* Header */
.main-header {
    height: var(--header-height);
    background-color: #ffffff;
    /* Solid white for reliability */
    /* backdrop-filter: blur(10px); Removed to prevent mobile fixed position context issues */
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    top: 0;
    z-index: 9999;
    /* Ensure strictly above everything */
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo img {
    max-height: 45px;
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-dark);
    position: relative;
    padding: 5px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--white);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 10px;
    z-index: 1001;
}

@media (min-width: 992px) {
    .dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(10px);
    }
}

.dropdown-item {
    padding: 10px 15px;
    display: block;
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background-color: var(--bg-light);
    color: var(--primary);
    padding-left: 20px;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
    padding: 5px;
}

/* Footer */
.main-footer {
    background: linear-gradient(135deg, var(--primary-dark), #152d1b);
    color: var(--white);
    padding: 80px 0 30px;
    margin-top: 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 50px;
}

.footer-col h3 {
    color: var(--accent);
    margin-bottom: 25px;
    font-family: 'Playfair Display', serif;
    letter-spacing: 0.5px;
}

.footer-links li {
    margin-bottom: 15px;
}

.footer-links a {
    color: #e0e0e0;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
    padding-left: 8px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    text-align: center;
    color: #aaa;
    font-size: 0.9rem;
}

/* Helper Class for Forms */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--primary-dark);
}

.form-control {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background-color: #FAFAFA;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 92, 56, 0.15);
    background-color: var(--white);
}

textarea.form-control {
    resize: vertical;
}

/* Responsive & Dynamic */
@media (max-width: 991px) {
    :root {
        --header-height: 60px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .menu-toggle {
        display: block;
        z-index: 10002;
        /* Above the menu overlay */
        position: relative;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--white);
        flex-direction: column;
        padding: 80px 20px 40px;
        /* Top padding to clear close button */
        box-shadow: none;
        align-items: flex-start;
        display: flex;
        /* Keep flex, hide with visibility/transform */
        visibility: hidden;
        opacity: 0;
        overflow-y: auto;
        transform: translateX(100%);
        /* Move off-screen by default */
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s;
        /* Smooth slide */
    }

    .nav-menu.active {
        transform: translateX(0) !important;
        /* Slide in */
        z-index: 10001;
        /* Max z-index */
        opacity: 1 !important;
        visibility: visible;
    }

    .nav-link {
        font-size: 1.1rem;
        display: block;
        width: 100%;
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    /* Mobile Dropdown */
    .dropdown {
        width: 100%;
    }

    .dropdown>.nav-link {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        padding: 0;
        transform: none;
        opacity: 1;
        visibility: visible;
        display: none;
        /* Hide by default */
        background: #f8f9fa;
        /* Slightly darker background for contrast */
        border-left: 3px solid var(--primary);
        /* Visual indicator of hierarchy */
        margin-top: 0;
        max-height: none;
        /* Reset max-height */
        overflow: visible;
        /* Ensure content flows */
        transition: none;
        /* Remove conflicting transitions */
        margin-left: 30px;
        /* Indent the whole block */
        width: calc(100% - 30px);
        /* Adjust width */
    }

    .dropdown.active .dropdown-menu {
        display: block;
        /* Show when active */
        margin-top: 5px;
        padding-bottom: 5px;
        animation: fadeIn 0.3s ease-in;
    }

    .dropdown-item {
        padding: 12px 15px 12px 15px;
        /* increased left padding */
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        color: var(--text-dark);
        display: block;
        opacity: 1;
        visibility: visible;
        animation: fadeIn 0.3s ease-in;
        /* ensure items fade in */
    }



    .dropdown-item:last-child {
        border-bottom: none;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    /* Collapse grids */
    .footer-grid,
    .container>div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        /* Force single column on mobile */
        gap: 30px !important;
    }
}

/* Small Phones Optimization */
@media (max-width: 480px) {
    :root {
        --header-height: 60px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 10px 20px;
        width: 100%;
        margin-bottom: 10px;
    }

    .container {
        padding: 0 15px;
    }

    .nav-menu {
        padding: 20px 15px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 30px;
    right: 30px;
    background-color: #25d366;
    color: var(--white);
    border-radius: 50%;
    text-align: center;
    font-size: 32px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease-in-out;
    animation: pulse 2s infinite;
}

.whatsapp-float:hover {
    background-color: #128c7e;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-float i {
    margin-top: 3px;
}

/* Pulse animation for WhatsApp button */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }

    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.7);
    }

    100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
}

/* Responsive adjustments for WhatsApp button */
@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 26px;
    }
}

@media (max-width: 480px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
        font-size: 24px;
    }
}

/* Impact Map Styles */
.impact-map-section {
    padding: 60px 0;
    background: var(--white);
}

.impact-map-intro {
    text-align: center;
    margin-bottom: 40px;
}

.impact-map-intro h2 {
    margin-bottom: 15px;
}

.impact-map-intro p {
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto 30px;
    font-size: 1.1rem;
}

/* Map Statistics Cards */
.map-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 25px 40px;
    border-radius: var(--radius-md);
    text-align: center;
    min-width: 180px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
    font-family: 'Playfair Display', serif;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.95;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card.secondary {
    background: linear-gradient(135deg, var(--secondary), #b8865a);
}

.stat-card.accent {
    background: linear-gradient(135deg, var(--accent), #d4a84d);
}

/* Map Container */
#impact-map {
    width: 100%;
    height: 500px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 3px solid var(--primary-light);
}

/* Custom Map Markers */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 40px;
    height: 40px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary);
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 2s infinite;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.marker-pin.ongoing {
    background: var(--primary);
}

.marker-pin.completed {
    background: var(--secondary);
}

.marker-pin i {
    color: var(--white);
    font-size: 18px;
    transform: rotate(45deg);
}

@keyframes bounce {

    0%,
    100% {
        transform: rotate(-45deg) translateY(0);
    }

    50% {
        transform: rotate(-45deg) translateY(-5px);
    }
}

/* Map Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: 280px !important;
}

.map-popup {
    padding: 0;
}

.popup-header {
    background: var(--bg-light);
    padding: 12px 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    border-bottom: 2px solid var(--primary-light);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.ongoing {
    background: var(--primary-light);
    color: var(--white);
}

.status-badge.completed {
    background: var(--secondary);
    color: var(--white);
}

.county-badge {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

.county-badge i {
    color: var(--primary);
    margin-right: 4px;
}

.map-popup h4 {
    margin: 15px 15px 10px;
    color: var(--primary-dark);
    font-size: 1.1rem;
    line-height: 1.4;
}

.popup-description {
    margin: 0 15px 10px;
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.6;
}

.popup-location {
    margin: 10px 15px 15px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.popup-location i {
    margin-right: 5px;
}

/* Map Legend */
.map-legend {
    background: var(--white);
    padding: 15px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 12px;
}

.legend-marker.ongoing {
    background: var(--primary);
}

.legend-marker.completed {
    background: var(--secondary);
}

/* Responsive Map Styles */
@media (max-width: 768px) {
    #impact-map {
        height: 400px;
    }

    .map-stats {
        gap: 15px;
    }

    .stat-card {
        padding: 20px 30px;
        min-width: 140px;
    }

    .stat-card .stat-number {
        font-size: 2rem;
    }

    .stat-card .stat-label {
        font-size: 0.8rem;
    }

    .leaflet-popup-content {
        width: 240px !important;
    }

    .map-popup h4 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    #impact-map {
        height: 350px;
        border-radius: var(--radius-sm);
    }

    .impact-map-section {
        padding: 40px 0;
    }

    .stat-card {
        flex: 1 1 45%;
        padding: 15px 20px;
        min-width: unset;
    }

    .map-legend {
        font-size: 0.85rem;
        padding: 12px;
    }
}

/* =====================================================
   Blog Post Rich Content Styles
   Scoped to .blog-content to avoid affecting other pages
   Restores proper TinyMCE / HTML formatting
   ===================================================== */
.blog-content {
    color: var(--text-dark);
    font-size: 1.1rem;
    line-height: 1.9;
    word-break: break-word;
}

/* Headings inside blog */
.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-dark);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.blog-content h1 {
    font-size: 2rem;
}

.blog-content h2 {
    font-size: 1.65rem;
    border-bottom: 2px solid #e8f0e8;
    padding-bottom: 0.4rem;
}

.blog-content h3 {
    font-size: 1.35rem;
}

.blog-content h4 {
    font-size: 1.15rem;
}

/* Paragraphs */
.blog-content p {
    margin-bottom: 1.4rem;
}

/* Lists — restore bullets & numbers (global reset strips them) */
.blog-content ul,
.blog-content ol {
    margin: 0 0 1.4rem 1.8rem;
    padding-left: 0;
}

.blog-content ul {
    list-style: disc;
}

.blog-content ul ul {
    list-style: circle;
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
}

.blog-content ol {
    list-style: decimal;
}

.blog-content li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

/* Blockquote */
.blog-content blockquote {
    border-left: 4px solid var(--primary);
    margin: 1.8rem 0;
    padding: 1rem 1.5rem;
    background: #f0f7f0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-light);
    font-style: italic;
    font-size: 1.05rem;
}

.blog-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Inline code & code blocks */
.blog-content code {
    background: #eef2ee;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-dark);
}

.blog-content pre {
    background: #1d2b1f;
    color: #d4f5d4;
    padding: 1.2rem 1.5rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: 1.4rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.blog-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

/* Images inside blog */
.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    display: block;
}

/* Tables */
.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.4rem;
    font-size: 0.95rem;
    overflow-x: auto;
    display: block;
}

.blog-content th,
.blog-content td {
    border: 1px solid #d0ddd0;
    padding: 10px 14px;
    text-align: left;
}

.blog-content th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.blog-content tr:nth-child(even) td {
    background: #f4f9f4;
}

/* Links */
.blog-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blog-content a:hover {
    color: var(--primary-dark);
}

/* Horizontal rule */
.blog-content hr {
    border: none;
    border-top: 2px solid #e0ece0;
    margin: 2rem 0;
}

/* Indent: TinyMCE inline padding-left styles are honoured automatically */

/* Responsive */
@media (max-width: 768px) {
    .blog-content {
        font-size: 1rem;
    }

    .blog-content h1 {
        font-size: 1.6rem;
    }

    .blog-content h2 {
        font-size: 1.35rem;
    }

    .blog-content h3 {
        font-size: 1.15rem;
    }
}