/* =========================================================
   AGAPE TRUST - MOBILE & TABLET FIXES (all pages)
   Loaded LAST on every page so it wins over page styles.
   Menu behaviour: js/mobile-nav.js
========================================================= */


/* ---------------------------------------------------------
   1. HEADER / NAVIGATION  (<= 1024px)
--------------------------------------------------------- */

.mobile-menu-toggle {
    display: none;
}

@media (max-width: 1024px) {

    .site-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        padding: 10px 0 !important;
    }

    .site-header .container {
        width: 92%;
        max-width: none;
    }

    .site-header .navbar {
        position: relative;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        min-height: 56px;
    }

    .site-header .logo-section {
        display: flex;
        align-items: center;
        min-width: 0;
        flex: 1 1 auto;
    }

    .site-header .logo img {
        width: 56px !important;
        height: 56px !important;
    }

    .site-header .logo-text {
        margin-left: 10px !important;
        min-width: 0;
    }

    .site-header .logo-text h2 {
        font-size: 20px !important;
        line-height: 1.1;
        white-space: nowrap;
    }

    .site-header .logo-text span {
        font-size: 10px !important;
        margin-top: 3px !important;
        white-space: nowrap;
    }


    /* Hamburger */

    .site-header .mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        margin: 0 0 0 auto;
        padding: 0;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #741b2a;
        cursor: pointer;
        position: relative;
        z-index: 1002;
        order: 3;
    }

    .mobile-menu-bars,
    .mobile-menu-bars::before,
    .mobile-menu-bars::after {
        display: block;
        width: 24px;
        height: 2.5px;
        border-radius: 2px;
        background: currentColor;
        transition: transform 0.25s ease, opacity 0.2s ease;
    }

    .mobile-menu-bars {
        position: relative;
    }

    .mobile-menu-bars::before,
    .mobile-menu-bars::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .mobile-menu-bars::before { top: -7px; }
    .mobile-menu-bars::after  { top: 7px; }

    .mobile-menu-toggle.is-open .mobile-menu-bars {
        background: transparent;
    }

    .mobile-menu-toggle.is-open .mobile-menu-bars::before {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-menu-toggle.is-open .mobile-menu-bars::after {
        transform: translateY(-7px) rotate(-45deg);
    }


    /* Menu panel: hidden until opened */

    .site-header .nav-menu {
        display: none !important;
    }

    .site-header .nav-menu.mobile-open {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        position: absolute !important;
        top: calc(100% + 10px) !important;
        left: -4.35% !important;
        right: -4.35% !important;
        width: auto !important;
        max-height: calc(100vh - 90px);
        max-height: calc(100dvh - 90px);
        overflow-y: auto;
        overscroll-behavior: contain;
        margin: 0 !important;
        padding: 6px 0 14px !important;
        background: #ffffff !important;
        border-top: 1px solid #eee;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14);
        z-index: 1001;
        transform: none !important;
    }

    .site-header .nav-menu.mobile-open > li {
        position: static !important;
        width: 100%;
        border-bottom: 1px solid #f1e8ea;
    }

    .site-header .nav-menu.mobile-open > li:last-child {
        border-bottom: 0;
    }

    .site-header .nav-menu.mobile-open > li > a {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 15px 22px !important;
        font-size: 16px !important;
        line-height: 1.3;
    }

    /* Chevron on items with a submenu */

    .site-header .nav-menu.mobile-open > li.has-mega > a::after {
        content: "";
        width: 8px;
        height: 8px;
        margin-left: 12px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translateY(-3px);
        transition: transform 0.2s ease;
        flex: 0 0 auto;
    }

    .site-header .nav-menu.mobile-open > li.has-mega.submenu-open > a::after {
        transform: rotate(-135deg) translateY(-3px);
    }


    /* Mega menus become simple link lists */

    .site-header .mega-menu {
        display: none !important;
    }

    .site-header .has-mega.submenu-open > .mega-menu {
        display: block !important;
        position: static !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 0 10px !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: #fbf6f7 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        pointer-events: auto !important;
    }

    .site-header .mega-menu .mega-card {
        display: none !important;
    }

    .site-header .mega-menu .mega-links {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
    }

    .site-header .mega-menu .mega-links a {
        display: block !important;
        width: auto !important;
        padding: 12px 22px 12px 36px !important;
        margin: 0 !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: none !important;
        transform: none !important;
    }
}

@media (max-width: 380px) {

    .site-header .logo img {
        width: 46px !important;
        height: 46px !important;
    }

    .site-header .logo-text h2 {
        font-size: 17px !important;
    }

    .site-header .logo-text span {
        font-size: 9px !important;
    }
}


/* ---------------------------------------------------------
   2. FOOTER
   Each page CSS carries its own copy of the footer styles
   (4-column grid, fixed min-widths); these override them all.
--------------------------------------------------------- */

@media (max-width: 1024px) {

    .site-footer .footer-container {
        max-width: 100%;
        padding: 0 28px;
    }

    .site-footer .footer-top {
        flex-direction: column;
        gap: 36px;
    }

    .site-footer .footer-brand,
    .site-footer .footer-connect {
        width: 100%;
        min-width: 0;
    }

    .site-footer .footer-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px 28px;
    }

    .site-footer .footer-bottom {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 600px) {

    .site-footer {
        padding: 40px 0 24px;
    }

    .site-footer .footer-container {
        padding: 0 18px;
    }

    .site-footer .brand-header img {
        width: 72px;
        height: 72px;
    }

    .site-footer .brand-title h2 {
        font-size: 24px;
    }

    .site-footer .footer-links {
        gap: 28px 18px;
        padding: 32px 0;
    }

    /* Contact column spans the full width */
    .site-footer .footer-links > div:last-child {
        grid-column: 1 / -1;
    }

    .site-footer .footer-links ul {
        padding-left: 0;
        list-style: none;
    }

    .site-footer .contact-list li > * {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .site-footer .newsletter form {
        align-items: stretch;
    }

    .site-footer .newsletter input {
        max-width: none;
    }
}


/* ---------------------------------------------------------
   3. GENERAL SAFEGUARDS (phones & small tablets)
--------------------------------------------------------- */

@media (max-width: 768px) {

    /* Grid/flex children may shrink below their content width,
       so long words (emails, IBANs) can't push columns off-screen */
    [class*="grid"] > *,
    [class*="layout"] > *,
    [class*="row"] > *,
    [class*="columns"] > * {
        min-width: 0;
    }

    h1, h2, h3, h4, p, li, a, span, strong {
        overflow-wrap: break-word;
    }

    img, video, iframe {
        max-width: 100%;
    }

    .site-footer .footer-right {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 12px;
        max-width: 100%;
    }

    .site-footer .footer-right a {
        white-space: nowrap;
    }
}


/* Page headings: some heroes were 46-60px on a 390px screen and
   broke words in half ("Transformin-g") */
@media (max-width: 600px) {

    h1:not(.site-header h1):not(.site-footer h1) {
        font-size: clamp(30px, 10vw, 42px) !important;
        line-height: 1.15 !important;
    }
}

/* ---------------------------------------------------------
   4. PAGE FIXES
--------------------------------------------------------- */

/* Donate: bank details were wider than the screen */
@media (max-width: 1000px) {

    .donate-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

@media (max-width: 600px) {

    .donate-block {
        padding: 26px 20px !important;
    }

    .donate-block h3 {
        font-size: 24px;
    }

    .detail-row {
        grid-template-columns: 1fr !important;
        gap: 4px;
        padding: 12px 0;
    }

    .detail-row strong,
    .contact-item a {
        overflow-wrap: anywhere;
    }

    .contact-item {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 4px !important;
    }
}

/* Partner: 60px padding left the form fields ~200px wide */
@media (max-width: 600px) {

    .partner-form-section .form-wrapper {
        padding: 32px 20px !important;
    }
}

/* Home: hero heading was a single 76px line (nowrap), wider than
   the screen below ~1300px */
@media (max-width: 1300px) {

    #hero .hero-content h1 {
        white-space: normal;
        transform: none;
        font-size: clamp(36px, 6vw, 72px);
        line-height: 1.15;
    }
}

@media (max-width: 1024px) {

    #hero {
        height: auto;
        min-height: 80vh;
        min-height: 80svh;
    }

    #hero .hero-content {
        width: 100%;
        max-width: 760px;
        padding: 0 24px;
    }

    #hero .hero-content h1 {
        white-space: normal;
        transform: none;
        font-size: clamp(36px, 8vw, 64px);
    }

    #hero .hero-content p {
        left: 0;
    }
}

/* Advocacy: impact intro was a two-column grid */
@media (max-width: 768px) {

    .need-layout {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 24px !important;
    }

    .need-title h2 {
        font-size: clamp(28px, 8.5vw, 36px) !important;
    }

    /* Three-, two- and four-column card grids, crushed on phones */
    .pillar-grid,
    .activities-grid,
    .impact-section .impact-grid:not(:has(.counter)) {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .impact-header {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 20px !important;
        margin-bottom: 40px !important;
    }
}


/* ---------------------------------------------------------
   5. SECTION SPACING ON PHONES
   Desktop paddings of 85-150px left most of a phone screen
   empty between sections.
--------------------------------------------------------- */

@media (max-width: 600px) {

    /* Home */
    .services,
    .thematic-areas,
    .impact-section,
    .testimonials,
    .partners,
    /* Advocacy */
    .project-introduction,
    .advocacy-pillars,
    .need-section,
    .what-we-do,
    .advocacy-quote,
    .project-cta,
    /* Business / Persecution / Sports */
    .intro-section,
    .values-section,
    .opportunity-section,
    .focus-section,
    .approach-section,
    .human-section,
    .community-section,
    .cta-section,
    /* About pages */
    .core-values,
    .leadership-team,
    .leadership-philosophy,
    .history-story,
    .vision-mission,
    /* Get involved / news / reports */
    .partner-intro,
    .partner-form-section,
    .news-cta,
    .project-need,
    .project-impact {
        padding-top: 64px !important;
        padding-bottom: 64px !important;
    }

    .accountability-section {
        padding-bottom: 64px !important;
    }

    .values-hero,
    .history-hero,
    .thematic-hero,
    .vm-hero {
        padding-top: 80px !important;
        padding-bottom: 80px !important;
    }
}


/* ---------------------------------------------------------
   6. HOME PAGE DETAILS
--------------------------------------------------------- */

@media (max-width: 600px) {

    /* "Transforming Lives Since 2006" broke mid-word at 3.5rem */
    .impact-section .section-header h2 {
        font-size: clamp(30px, 8.5vw, 40px);
        line-height: 1.2;
    }

    /* Join our mission */
    .cta-section .cta-heading {
        margin-bottom: 28px;
    }

    .cta-section .cta-heading h2 {
        margin: 10px 0 14px;
    }

    .cta-section .cta-text {
        margin-bottom: 28px;
    }

    .cta-section .cta-text h3 {
        margin-bottom: 10px;
    }

    .cta-section .cta-cards {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding-right: 30px;
    }

    .cta-section .cta-card {
        width: 100%;
    }
}

@media (max-width: 600px) {

    /* Impact numbers: 2 x 2 instead of four full-width cards */
    .impact-section .impact-grid:has(.counter) {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

    .impact-section .impact-card {
        padding: 26px 12px !important;
    }

    .impact-section .impact-card h3 {
        font-size: 34px !important;
    }

    .impact-section .impact-card p {
        font-size: 12px !important;
        letter-spacing: 0.5px;
    }
}


/* ---------------------------------------------------------
   7. FIXES AT ALL SCREEN SIZES
   (this is the one stylesheet every page loads)
--------------------------------------------------------- */

/* Newsletter blurb inherited the dark body text colour on
   the dark footer and was invisible */
.site-footer .newsletter p {
    color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 700px) {

    /* Footer logo + name side by side, left aligned */
    .site-footer .brand-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 14px !important;
        text-align: left;
    }

    .site-footer .brand-title {
        text-align: left;
    }
}

/* Core Values hero label had no style (dark text on maroon);
   same treatment as the other About pages */
.values-hero .page-tag {
    color: #D4AF37;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Business page footer blurb was all-caps with wide letter spacing */
.site-footer .footer-brand p {
    text-transform: none;
    letter-spacing: normal;
}

/* Donate: "Every contribution helps..." was maroon on the maroon card */
.donate-side .support-message h3 {
    color: #ffffff;
}
