/* ============================================
   DESKTOP — hide mobile-only elements
   ============================================ */

/* The mobile donate button injected by JS must be hidden on desktop */
.nav-mobile-donate {
    display: none;
}

/* responsive.css — Media queries */

/* ============================================
   TABLET (max 992px)
   ============================================ */

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

    /* ===== LOGO — constrain size so it never overlaps nav ===== */
    .site-header .logo {
        flex-shrink: 0;
        max-width: 48px;      /* show only the icon part of the logo image */
        overflow: hidden;
    }

    .site-header .logo img {
        height: 48px;
        width: auto;
        max-width: none;      /* let it be wider than the container — clipped by overflow:hidden */
        display: block;
    }

    /* ===== HEADER CONTAINER — tight flex row ===== */
    .site-header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding-left: 12px;
        padding-right: 12px;
        position: relative;
    }

    /* Nav takes remaining space, hamburger sits on the right */
    .site-header .main-nav {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    /* ===== MOBILE NAV — starts at 992px ===== */

    /* Hide donate button from header bar on mobile —
       it will appear inside the open nav menu instead */
    .site-header .donate-btn {
        display: none !important;
    }

    /* Hamburger visible */
    .mobile-menu-toggle {
        display: block;
    }

    /* Nav menu — hidden by default, slides open */
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #1a4a2e;   /* deep green — always readable */
        flex-direction: column;
        padding: 12px 0 20px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.25);
        z-index: 9998;
        gap: 0;
        /* Scrollable on small screens */
        max-height: calc(100svh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links.active {
        display: flex;
    }

    /* Top-level nav links */
    .nav-links > li > a {
        color: #ffffff !important;   /* always white in open menu */
        padding: 13px 24px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        font-size: 0.95rem;
        font-weight: 600;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        text-decoration: none;
    }

    .nav-links > li > a:hover {
        background-color: rgba(255,255,255,0.08);
        color: #a8d5a2 !important;
    }

    .nav-links > li:last-child > a {
        border-bottom: none;
    }

    /* Donate Now button — lives INSIDE the menu on mobile */
    .nav-links::after {
        content: '';  /* placeholder — actual button injected via JS below */
    }

    /* ===== DROPDOWN in mobile menu ===== */

    /* Override any page-specific CSS that hides/collapses dropdowns */
    .nav-links .dropdown-menu {
        position: static !important;
        transform: none !important;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        background-color: rgba(0,0,0,0.2);
        transition: opacity 0.28s ease, max-height 0.28s ease;
        pointer-events: none;
        width: 100%;
        min-width: unset;
        list-style: none;
    }

    /* Open state — triggered by .dropdown-open class from shared.js */
    .nav-links .has-dropdown.dropdown-open .dropdown-menu {
        opacity: 1;
        max-height: 500px;
        pointer-events: all;
    }

    /* Dropdown items — clearly visible on dark background */
    .nav-links .dropdown-menu li a {
        color: rgba(255,255,255,0.88) !important;
        padding: 11px 24px 11px 40px;   /* indent to show hierarchy */
        font-size: 0.88rem;
        font-weight: 400 !important;
        display: block;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        background-color: transparent;
        text-decoration: none;
    }

    .nav-links .dropdown-menu li:last-child a {
        border-bottom: none;
    }

    .nav-links .dropdown-menu li a:hover {
        background-color: rgba(255,255,255,0.08);
        color: #a8d5a2 !important;
    }

    /* Arrow rotates when dropdown is open */
    .has-dropdown.dropdown-open .nav-arrow {
        transform: rotate(180deg);
    }

    /* Donate Now inside menu — shown as a styled row at the bottom */
    .nav-links .nav-mobile-donate {
        display: block;
        margin: 14px 16px 0;
        padding: 13px 20px;
        background-color: var(--accent-green, #4a7c59);
        color: #ffffff !important;
        text-align: center;
        border-radius: 6px;
        font-weight: 700;
        font-size: 0.95rem;
        text-decoration: none;
        transition: background-color 0.2s;
    }

    .nav-links .nav-mobile-donate:hover {
        background-color: #3a6449;
    }
}

/* ============================================
   MOBILE (max 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.35rem; }

    /* Header container */
    .site-header .container {
        position: relative;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .footer-about,
    .footer-links,
    .footer-contact,
    .footer-social {
        text-align: center;
    }

    /* ============================================
       FORCE ALL CARD GRIDS TO SINGLE COLUMN
       ============================================ */

    /* home.css grids */
    .focus-grid,
    .impact-grid,
    .testimonial-grid,
    .activity-grid,
    .news-grid { grid-template-columns: 1fr !important; }

    /* about.css grids */
    .values-grid,
    .focus-grid,
    .mv-grid { grid-template-columns: 1fr !important; }

    /* programs.css grids */
    .program-grid,
    .activities-grid,
    .beneficiaries-grid { grid-template-columns: 1fr !important; }

    /* projects.css grids */
    .projects-grid,
    .approach-grid { grid-template-columns: 1fr !important; }

    /* impact.css grids */
    .highlights-grid,
    .action-grid { grid-template-columns: 1fr !important; }

    /* news.css grids */
    .activities-grid,
    .media-grid { grid-template-columns: 1fr !important; }

    /* get-involved.css grids */
    .involvement-grid { grid-template-columns: 1fr !important; }

    /* donate.css grids */
    .donation-impact-grid { grid-template-columns: 1fr !important; }

    /* contact.css grids */
    .contact-cards { grid-template-columns: 1fr !important; }
}

/* ============================================
   SMALL MOBILE (max 576px)
   ============================================ */

@media (max-width: 576px) {
    .section {
        padding: var(--space-md) 0;
    }

    .btn {
        display: block;
        width: 100%;
    }
}
