/* Root-level horizontal scroll prevention */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    margin-top: 100px;
    padding: 0;
}

/* Ensure main content doesn't exceed viewport */
.main-content {
    max-width: 100vw;
    box-sizing: border-box;
}

/* Fix logo container for mobile */
@media (max-width: 480px) {
    .logo-container {
        min-width: auto !important;
        width: auto !important;
        flex: 1 !important;
        justify-content: space-between !important;
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .brand-name {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: calc(100vw - 120px) !important;
    }
    
    /* Fix filter containers */
    .filter-container {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .filter-btn {
        min-width: auto !important;
        flex: 1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Ensure all content respects viewport */
    .newsletter-container,
    .main-content,
    .footer-container {
        max-width: 100vw !important;
        box-sizing: border-box !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

/* Additional fixes for very small screens */
@media (max-width: 360px) {
    .brand-name {
        font-size: 0.9rem !important;
        max-width: calc(100vw - 85px) !important;
    }
    
    .logo {
        height: 30px !important;
        margin-right: 6px !important;
    }
    
    .hamburger-menu {
        width: 20px !important;
        height: 18px !important;
    }

    .hero-title {
        font-size: 1.3rem !important;
    }

    .hero-subtitle {
        font-size: 0.8rem !important;
        padding: 0 0.5rem;
    }

    .filter-btn {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.6rem !important;
    }

    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 0.6rem !important;
        padding: 0 0.25rem !important;
    }

    .filter-toggle-btn {
        font-size: 0.8rem !important;
        padding: 0.6rem 1rem !important;
    }

    .modal-nav {
        width: 35px;
        height: 35px;
        font-size: 1.4rem;
    }

    .modal-prev {
        left: 5px;
    }

    .modal-next {
        right: 5px;
    }
}

/* Responsive Media Queries */

/* Very Large Screens - Above 1600px */
@media (min-width: 1601px) {
    /* Homepage featured section - side by side layout */
    .homepage-featured-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 3rem !important;
        align-items: center;
    }
    
    .homepage-featured-grid img {
        height: auto !important;
    }

    /* Ensure proper layout for header */
    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: 100px;
        padding: 0 2rem;
    }

    .logo-container {
        justify-content: flex-start;
        margin-left: 0;
        min-width: auto;
    }

    .nav-container {
        justify-content: flex-end;
        margin-right: 0;
        flex: none;
    }

    .hamburger-menu {
        display: none;
    }

    .nav-container {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        padding: 0;
    }

    .nav {
        flex-direction: row;
        background: transparent;
        padding: 0;
    }
}

/* Large Screens - Below 1600px */
@media (max-width: 1600px) {
    body {
        margin-top: 180px;
    }
    .header-container {
        flex-direction: column;
        justify-content: center;
        height: auto;
        padding: 1rem 0;
        gap: 1rem;
    }

    .logo-container {
        justify-content: center;
        margin-left: 0;
        min-width: auto;
    }

    .nav-container {
        justify-content: center;
        margin-right: 0;
        flex: none;
    }

    /* Navigation buttons with reduced height */
    .nav-link {
        padding: 0.6rem 1.5rem !important;
        font-size: 1rem !important;
    }

    /* Fix text sizes for large screens */
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    /* Homepage featured section - stacked layout */
    .homepage-featured-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .homepage-featured-grid img {
        height: auto !important;
    }
}

/* Medium Screens - Below 1200px (Hamburger Menu) */
@media (max-width: 1200px) {
    /* Prevent horizontal scroll when nav is off-screen */
    body {
        overflow-x: hidden;
        margin-top: 60px;
    }

    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: 80px;
        padding: 0 1rem;
        gap: 0;
        position: relative;
    }

    .logo-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        position: relative;
    }

    .logo {
        height: 60px;
        z-index: 1001;
    }

    .brand-name {
        font-size: 1.5rem;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
        z-index: 1000;
        pointer-events: none;
    }

    .hamburger-menu {
        display: flex !important;
        z-index: 1002;
        margin-left: auto;
        position: relative;
        cursor: pointer;
    }

    .nav-container {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: rgba(0, 0, 0, 0); /* Start transparent */
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding-top: 100px;
        z-index: 999;
        margin-right: 0;
        transition: background 0.3s ease; /* Fade overlay */
    }

    .nav {
        flex-direction: column;
        gap: 0;
        background: white;
        border-radius: 0;
        padding: 1rem 0;
        width: 100%;
        height: auto;
        margin: 0;
    }

    .nav::before {
        display: none;
    }

    .nav-link {
        width: 100%;
        text-align: left;
        padding: 1rem 2rem;
        margin: 0.25rem 1rem;
        border-radius: 8px;
        border: none;
        font-size: 1.2rem;
        color: var(--text-color);
        transition: all 0.3s ease;
        background: rgba(0, 0, 0, 0.02);
        display: block;
        width: calc(100% - 2rem);
    }

    .nav-link:hover,
    .nav-link.active {
        background: var(--gradient-secondary);
        color: white;
        transform: translateX(5px);
        box-shadow: 0 2px 8px rgba(162, 68, 100, 0.2);
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .nav-container.active {
        right: 0;
        width: 100vw;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        top: 80px;
        height: calc(100vh - 80px);
        padding-top: 0;
        padding-left: calc(100vw - 300px);
        padding-right: 0;
        transition: background 0.3s ease; /* Fade in overlay */
    }

    /* Initial state - transparent overlay */
    .nav-container {
        background: rgba(0, 0, 0, 0);
        transition: background 0.3s ease;
    }

    .nav-container.active .nav {
        background: white;
        width: 300px;
        margin-left: 0;
        padding-top: 1rem;
        border-radius: 0 0 0 20px;
        box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease; /* Only animate the nav panel */
        transform: translateX(0);
    }

    /* When nav is inactive, slide the nav panel off to the right */
    .nav-container .nav {
        transition: transform 0.3s ease;
        transform: translateX(100%);
    }
}

/* Tablet Screens - Below 768px */
@media (max-width: 768px) {
    /* Prevent horizontal scroll when nav is off-screen */
    body {
        overflow-x: hidden;
    }

    /* Header adjustments for smaller screens */
    .header-container {
        padding: 0 0.5rem;
        height: 70px;
    }

    .brand-name {
        font-size: 1.3rem;
    }

    .logo {
        height: 50px;
    }

    /* Text size adjustments */
    .hero-title {
        font-size: 2rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem !important;
        line-height: 1.4;
        margin-bottom: 1.5rem;
        padding: 0 1rem;
    }

    .hero-section {
        padding: 2rem 0;
    }

    /* Filter button improvements */
    .filter-container {
        flex-direction: column !important;
        gap: 0.5rem !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 1rem;
    }

    .filter-row {
        margin-bottom: 1rem;
    }

    .filter-btn {
        width: 100% !important;
        min-width: auto !important;
        flex: none !important;
        font-size: 0.9rem !important;
        padding: 0.7rem 1rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .filter-btn-category {
        padding: 0.7rem 1rem !important;
        min-width: auto !important;
    }

    .filter-btn-project {
        padding: 0.7rem 1rem !important;
        min-width: auto !important;
    }

    /* Filter Toggle Button for Tablet */
    .filter-toggle-container {
        text-align: center;
        margin: 1rem 0;
        padding: 0 1rem;
    }

    .filter-toggle-btn {
        background: var(--gradient-secondary);
        color: white;
        border: none;
        padding: 0.8rem 2rem;
        border-radius: 25px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(162, 68, 100, 0.3);
        width: auto;
        min-width: 200px;
        max-width: 300px;
    }

    .filter-toggle-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(162, 68, 100, 0.4);
    }

    .filter-toggle-btn:active {
        transform: translateY(0);
    }

    /* Gallery grid adjustments */
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
        gap: 1rem !important;
        padding: 0 1rem !important;
    }

    .gallery-item {
        margin-bottom: 1rem;
    }

    .gallery-overlay h4 {
        font-size: 0.9rem;
    }

    .gallery-overlay p {
        font-size: 0.8rem;
    }

    .nav-container {
        width: 280px;
        padding-top: 1rem;
        background: rgba(0, 0, 0, 0); /* Start transparent */
        z-index: 999;
        transition: background 0.3s ease; /* Fade overlay */
    }

    .nav-container.active {
        width: 100vw;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        top: 70px;
        height: calc(100vh - 70px);
        padding-top: 0;
        padding-left: calc(100vw - 280px);
        padding-right: 0;
        transition: background 0.3s ease; /* Fade in overlay */
    }

    .nav-container.active .nav {
        background: white;
        width: 280px;
        margin-left: 0;
        padding-top: 1rem;
        border-radius: 0 0 0 15px;
        box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease; /* Only animate the nav panel */
        transform: translateX(0);
    }

    /* When nav is inactive, slide the nav panel off to the right */
    .nav-container .nav {
        transition: transform 0.3s ease;
        transform: translateX(100%);
    }

    .nav {
        background: white;
        padding: 1rem 0;
    }

    .nav-link {
        padding: 0.8rem 1.5rem;
        margin: 0.2rem 1rem;
        font-size: 1.1rem;
        text-align: left;
        background: rgba(0, 0, 0, 0.02);
        border-radius: 6px;
        width: calc(100% - 2rem);
    }

    /* Modal Navigation */
    .modal-nav {
        font-size: 1.8rem;
        width: 45px;
        height: 45px;
        padding: 0.6rem 1rem;
    }

    .modal-prev {
        left: 15px;
    }

    .modal-next {
        right: 15px;
    }

    /* Logo Modal */
    .logo-modal-content {
        max-width: 90vw;
        padding: 1.5rem;
    }

    .logo-modal-image {
        max-width: 300px;
    }

    .logo-modal-content .modal-caption h3 {
        font-size: 1.3rem;
    }

    .logo-modal-content .modal-caption p {
        font-size: 0.9rem;
    }

    /* Project Modal */
    .project-modal-content {
        margin: 1rem;
        max-height: 95vh;
    }

    .project-modal_body {
        padding: 1.5rem;
    }

    .project-modal-header h2 {
        font-size: 1.5rem;
    }

    .project-image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.5rem;
    }

    .project-image-gallery img {
        height: 150px;
    }

    .project-modal-actions {
        flex-direction: column;
        align-items: center;
    }

    .donate-button,
    .secondary-button {
        width: 100%;
        max-width: 250px;
        text-align: center;
    }

    /* Newsletter */
    .newsletter-header {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .newsletter-title {
        font-size: 1.1rem;
    }

    .newsletter-date {
        font-size: 0.8rem;
    }

    .expand-button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .newsletter-content {
        padding: 0 1rem;
    }

    .newsletter-content.expanded {
        padding: 1rem 1rem 1.5rem 1rem;
    }

    .newsletter-content p {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }

    .newsletter-content img {
        height: 200px;
        margin: 1.5rem 0;
    }

    /* Image galleries within newsletters */
    .newsletter-content div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .newsletter-content div[style*="display: flex"] img {
        width: 100% !important;
        height: 200px !important;
        margin: 1rem 0 !important;
    }

    .newsletter-container {
        max-width: 100% !important;
        gap: 2rem !important;
        padding: 0 0.5rem;
    }

    /* Newsletter navigation buttons responsive */
    .newsletter-nav-container {
        flex-wrap: wrap !important;
        gap: 1rem !important;
        justify-content: center !important;
        padding: 0.5rem;
        margin-bottom: 1.5rem !important;
    }

    .newsletter-nav-btn,
    #newsletterIndicator {
        min-width: 100px !important;
        font-size: 0.85rem !important;
        padding: 0.6rem 0.8rem !important;
        flex-shrink: 0;
        white-space: nowrap;
    }

    #newsletterIndicator {
        min-width: 120px !important;
    }

    #newsletterIndicator span {
        font-size: 0.8rem !important;
    }

    /* Homepage featured section responsive */
    .homepage-featured-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .homepage-featured-grid img {
        height: auto !important;
    }

    /* Fix main content padding */
    .main-content {
        padding: 0 0.5rem;
    }

    /* Footer improvements */
    .footer-container {
        padding: 0 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        text-align: center;
    }

    .footer-section {
        text-align: center;
    }

    .footer-section h3 {
        font-size: 1.2rem;
        text-align: center;
    }

    /* Center the dividing lines under headings */
    .footer-section h3::after {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    /* Center the list markers */
    .footer-section ul {
        display: inline-block;
        text-align: left;
        padding-left: 0 !important;
    }

    .footer-section ul li {
        padding-left: 1rem !important;
        text-align: left;
    }

    /* Center the newsletter form */
    .newsletter-form {
        justify-content: center !important;
        max-width: 400px;
        margin: 1rem auto 0 auto !important;
    }

    .footer-section p,
    .footer-section li {
        font-size: 0.9rem;
    }
}
@media (max-width: 480px) {
    /* Prevent horizontal scroll when nav is off-screen */
    body {
        overflow-x: hidden;
    }

    /* Header adjustments for mobile */
    .header-container {
        padding: 0 0.5rem;
        height: 60px;
    }

    .brand-name {
        font-size: 1rem !important;
        max-width: calc(100vw - 100px) !important;
    }

    .logo {
        height: 35px !important;
        margin-right: 8px !important;
    }

    .hamburger-menu {
        width: 25px;
        height: 20px;
        display: flex !important;
        z-index: 1002;
        position: relative;
        cursor: pointer;
    }

    /* Text size adjustments for mobile */
    .hero-title {
        font-size: 1.5rem !important;
        line-height: 1.2;
        margin-bottom: 0.8rem;
    }

    .hero-subtitle {
        font-size: 0.9rem !important;
        line-height: 1.4;
        margin-bottom: 1rem;
        padding: 0 1rem;
    }

    .hero-section {
        padding: 1.5rem 0;
    }

    /* Filter section mobile improvements */
    .filter-section {
        margin-top: 1rem !important;
        padding: 0 0.5rem;
    }

    .filter-container {
        flex-direction: column !important;
        gap: 0.5rem !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 0;
    }

    .filter-row {
        margin-bottom: 1rem;
    }

    .filter-btn {
        width: 100% !important;
        min-width: auto !important;
        flex: none !important;
        font-size: 0.85rem !important;
        padding: 0.6rem 0.8rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        margin-bottom: 0.5rem;
    }

    .filter-btn-category {
        padding: 0.6rem 0.8rem !important;
        min-width: auto !important;
    }

    .filter-btn-project {
        padding: 0.6rem 0.8rem !important;
        min-width: auto !important;
    }

    /* Gallery grid adjustments for mobile */
    .gallery-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.8rem !important;
        padding: 0 0.5rem !important;
    }

    .gallery-item {
        margin-bottom: 0.5rem;
    }

    .gallery-card {
        border-radius: 8px;
    }

    .gallery-overlay h4 {
        font-size: 0.8rem;
    }

    .gallery-overlay p {
        font-size: 0.7rem;
    }

    /* Navigation adjustments */
    .nav-container {
        width: 100vw;
        right: -100vw;
        padding-top: 1rem;
        background: rgba(0, 0, 0, 0); /* Start transparent */
        z-index: 999;
        transition: background 0.3s ease; /* Fade overlay */
    }

    .nav-container.active {
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        top: 60px;
        height: calc(100vh - 60px);
        padding-top: 0;
        padding-left: 0;
        padding-right: 0;
        transition: background 0.3s ease; /* Fade in overlay */
    }

    .nav-container.active .nav {
        background: white;
        width: 100vw;
        margin-left: 0;
        padding-top: 1rem;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease; /* Only animate the nav panel */
        transform: translateX(0);
    }

    /* When nav is inactive, slide the nav panel off to the right */
    .nav-container .nav {
        transition: transform 0.3s ease;
        transform: translateX(100%);
    }

    .nav {
        background: white;
        padding: 1rem 0;
    }

    .nav-link {
        padding: 0.8rem 1rem;
        margin: 0.2rem 0.8rem;
        font-size: 1rem;
        text-align: left;
        background: rgba(0, 0, 0, 0.02);
        border-radius: 6px;
        width: calc(100% - 1.6rem);
    }

    /* Modal Navigation */
    .modal-nav {
        font-size: 1.6rem;
        width: 40px;
        height: 40px;
        padding: 0.5rem 0.8rem;
    }

    .modal-prev {
        left: 10px;
    }

    .modal-next {
        right: 10px;
    }

    /* Modal Content */
    .modal-content {
        max-width: 95vw;
        margin: 1rem;
    }

    .modal-content img {
        max-width: 90vw;
        max-height: 50vh;
    }

    .modal-caption {
        padding: 1rem;
    }

    .modal-caption h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .modal-caption p {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .modal-counter {
        font-size: 0.8rem;
        margin-top: 0.5rem;
    }

    /* Logo Modal */
    .logo-modal-content {
        padding: 1rem;
        margin: 0.5rem;
    }

    .logo-modal-image {
        max-width: 200px;
        margin-bottom: 1rem;
    }

    .logo-modal-content .modal-caption h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .logo-modal-content .modal-caption p {
        font-size: 0.8rem;
    }

    /* Project Modal */
    .project-modal-body {
        padding: 1rem;
    }

    .project-image-gallery {
        grid-template-columns: 1fr;
    }

    /* Newsletter */
    .newsletter-header {
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .newsletter-title {
        font-size: 0.95rem;
    }

    .newsletter-date {
        font-size: 0.7rem;
    }

    .expand-button {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .newsletter-content {
        padding: 0 0.8rem;
    }

    .newsletter-content.expanded {
        padding: 0.8rem 0.8rem 1rem 0.8rem;
    }

    .newsletter-content p {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    .newsletter-content img {
        height: 120px;
        margin: 1rem 0;
    }

    /* Even smaller images for mobile */
    .newsletter-content div[style*="display: flex"] img {
        height: 120px !important;
    }

    .newsletter-container {
        gap: 1.5rem !important;
        padding: 0 0.5rem;
    }

    /* Filter Toggle Button for Mobile */
    .filter-toggle-container {
        text-align: center;
        margin: 1rem 0;
        padding: 0 0.5rem;
    }

    .filter-toggle-btn {
        background: var(--gradient-secondary);
        color: white;
        border: none;
        padding: 0.7rem 1.5rem;
        border-radius: 25px;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(162, 68, 100, 0.3);
        width: calc(100% - 1rem);
        max-width: 250px;
        min-width: auto;
    }

    .filter-toggle-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(162, 68, 100, 0.4);
    }

    .filter-toggle-btn:active {
        transform: translateY(0);
    }

    /* Footer improvements for mobile */
    .footer-container {
        padding: 0 0.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-section {
        text-align: center;
    }

    .footer-section h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        text-align: center;
    }

    /* Center the dividing lines under headings */
    .footer-section h3::after {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    /* Center the list markers */
    .footer-section ul {
        display: inline-block;
        text-align: left;
        padding-left: 0 !important;
    }

    .footer-section ul li {
        padding-left: 1rem !important;
        text-align: left;
    }

    /* Center and stack the newsletter form on mobile */
    .newsletter-form {
        flex-direction: column !important;
        gap: 0.8rem !important;
        max-width: 300px;
        margin: 1rem auto 0 auto !important;
    }

    .newsletter-input {
        width: 100% !important;
        max-width: none !important;
        text-align: center;
    }

    .newsletter-button {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Newsletter page specific mobile fixes */
@media (max-width: 768px) {
    /* Fix newsletter navigation buttons */
    .newsletter-container > div:first-child {
        flex-wrap: wrap !important;
        gap: 1rem !important;
        padding: 0 0.5rem !important;
    }
    
    .newsletter-nav-btn {
        min-width: auto !important;
        flex: 1 !important;
        max-width: 45% !important;
        font-size: 0.9rem !important;
        padding: 0.6rem 1rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    #newsletterIndicator {
        min-width: auto !important;
        flex: 1 !important;
        max-width: 100% !important;
        font-size: 0.85rem !important;
        padding: 0.6rem 1rem !important;
        margin: 0.5rem 0 !important;
    }
    
    /* Fix newsletter content width */
    .newsletter-card {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .newsletter-content {
        max-width: 100% !important;
        overflow-x: hidden !important;
        word-wrap: break-word !important;
    }
    
    /* Fix newsletter images */
    .newsletter-content img {
        max-width: 100% !important;
        height: auto !important;
        width: 100% !important;
    }
    
    .newsletter-content div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .newsletter-content div[style*="display: flex"] img {
        width: 100% !important;
        height: auto !important;
        margin: 1rem 0 !important;
    }
    
    /* Center the newsletter signup section */
    .main-content .newsletter-form {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 1rem !important;
        max-width: 350px !important;
        margin: 0 auto !important;
        padding: 0 1rem !important;
    }
    
    .main-content .newsletter-input {
        width: 100% !important;
        max-width: 300px !important;
        text-align: center !important;
        margin: 0 auto !important;
    }
    
    .main-content .newsletter-button {
        width: 100% !important;
        max-width: 200px !important;
        margin: 0 auto !important;
        align-self: center !important;
    }
}

@media (max-width: 480px) {
    .newsletter-nav-btn {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.8rem !important;
    }
    
    #newsletterIndicator {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.8rem !important;
    }
    
    .main-content .newsletter-form {
        max-width: 300px !important;
        padding: 0 0.5rem !important;
    }
    
    .main-content .newsletter-input {
        max-width: 250px !important;
    }
    
    .main-content .newsletter-button {
        max-width: 180px !important;
    }
}

/* Mobile screens with background spacing (like desktop) */
@media (max-width: 768px) {
    body {
        background: var(--gradient-primary) !important;
    }
    
    .main-content {
        max-width: 95vw !important;
        margin: 2rem auto !important;
        border-radius: 20px !important;
        background: var(--white-transparent) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
        backdrop-filter: blur(10px) !important;
        padding: 2rem 1rem !important;
    }
    
    .hero-section {
        padding: 2rem 0 !important;
    }
}

@media (max-width: 480px) {
    .main-content {
        max-width: 92vw !important;
        padding: 1.5rem 0.5rem !important;
    }
    
    .hero-section {
        padding: 1.5rem 0 !important;
    }
}

@media (max-width: 360px) {
    .main-content {
        max-width: 90vw !important;
        padding: 1.2rem 0.4rem !important;
    }
    
    .hero-section {
        padding: 1.2rem 0 !important;
    }
}

/* Ensure background is visible on all screen sizes above 768px */
@media (min-width: 769px) {
    body {
        background: var(--gradient-primary) !important;
    }
    
    .main-content {
        max-width: 96vw !important;
        margin: 2rem auto !important;
        border-radius: 20px !important;
        background: var(--white-transparent) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
        backdrop-filter: blur(10px) !important;
    }
}

/* For very large screens, ensure there's still some background visible */
@media (min-width: 1400px) {
    .main-content {
        max-width: 1300px !important;
    }
}

@media (min-width: 1600px) {
    .main-content {
        max-width: 1500px !important;
    }
}

@media (min-width: 1920px) {
    .main-content {
        max-width: 1700px !important;
    }
}

/* Additional responsive fixes for all breakpoints */

/* Ensure no elements exceed viewport width */
@media (max-width: 1200px) {
    .newsletter-form {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .newsletter-input {
        width: 100%;
        max-width: 300px;
    }
    
    .newsletter-button {
        width: 100%;
        max-width: 300px;
    }
}

/* Tablet and below improvements */
@media (max-width: 768px) {
    .footer-section a[href="contact.html"] {
        padding: 0.6rem 1.2rem !important;
        font-size: 0.9rem !important;
        margin-top: 0.8rem !important;
    }
    
    .footer-section ul li {
        margin-bottom: 0.5rem;
        word-wrap: break-word;
    }
    
    .footer-section p {
        word-wrap: break-word;
        line-height: 1.4;
    }

    /* Center the dividing lines under headings */
    .footer-section h3::after {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    /* Center the list items properly */
    .footer-section ul {
        display: inline-block;
        text-align: left;
    }
}

/* Mobile specific improvements */
@media (max-width: 480px) {
    .footer-bottom {
        padding: 1rem 0.5rem !important;
        text-align: center;
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
        margin: 0;
    }
    
    /* Ensure long URLs break properly */
    .footer-section a {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* Fix any potential wide content */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Filter Toggle Media Queries */
/* Show filter toggle only on mobile screens */
@media (max-width: 768px) {
    .filter-toggle-container {
        display: block !important;
    }
    
    .filter-section {
        transition: all 0.3s ease;
        overflow: hidden;
    }
    
    .filter-section.hidden {
        max-height: 0 !important;
        opacity: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: translateY(-10px);
        visibility: hidden;
    }

    .filter-section:not(.hidden) {
        max-height: 800px !important;
        opacity: 1 !important;
        margin: 2rem 0 !important;
        padding: 1rem 0 2rem 0 !important;
        transform: translateY(0);
        visibility: visible;
    }
}

/* Ensure desktop screens hide filter toggle */
@media (min-width: 769px) {
    .filter-toggle-container {
        display: none !important;
    }
    
    .filter-section {
        display: block !important;
        opacity: 1 !important;
        max-height: none !important;
        margin: 2rem 0 !important;
        padding: 1rem 0 !important;
        visibility: visible !important;
    }

    .filter-section.hidden {
        display: block !important;
        opacity: 1 !important;
        max-height: none !important;
        margin: 2rem 0 !important;
        padding: 1rem 0 !important;
        visibility: visible !important;
    }
}

/* Mobile newsletter and card improvements */
@media (max-width: 768px) {
    .newsletter-container {
        max-width: 1000px !important;
        margin: 0 auto !important;
        padding: 0 1rem !important;
    }
    
    .card {
        margin: 2rem 0 !important;
        border-radius: 15px !important;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1) !important;
        background: white !important;
    }
    
    .newsletter-card {
        margin: 2rem 0 !important;
        border-radius: 15px !important;
    }
}

@media (max-width: 480px) {
    .newsletter-container {
        padding: 0 0.5rem !important;
    }
}

/* Mobile footer with full width */
@media (max-width: 768px) {
    .footer {
        background: var(--gradient-secondary) !important;
        margin: 2rem 0 0 0 !important;
        border-radius: 0 !important;
        width: 100vw !important;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw !important;
        margin-right: -50vw !important;
    }
    
    .footer-container {
        max-width: none !important;
        margin: 0 !important;
        padding: 2rem 1rem !important;
    }
}

@media (max-width: 480px) {
    .footer {
        margin-top: 1.5rem !important;
    }
    
    .footer-container {
        padding: 1.5rem 0.5rem !important;
    }
}

/* Preserve gradient backgrounds for special cards on mobile */
@media (max-width: 768px) {
    /* Ensure donation card keeps its gradient background */
    .card[style*="linear-gradient"] {
        background: linear-gradient(135deg, var(--accent-1), var(--accent-2)) !important;
        box-shadow: 0 6px 24px rgba(162,68,100,0.15) !important;
    }
    
    /* Preserve other styled cards with gradients */
    .card[style*="var(--gradient-secondary)"] {
        background: var(--gradient-secondary) !important;
    }
    
    /* Override the general white background rule for gradient cards */
    .card[style*="gradient"] {
        background: var(--gradient-secondary) !important;
    }
}

@media (max-width: 480px) {
    .card[style*="linear-gradient"] {
        background: linear-gradient(135deg, var(--accent-1), var(--accent-2)) !important;
    }
}

/* ========================================
   COMPREHENSIVE TEXT SIZE RESPONSIVE RULES
   ======================================== */

/* Tablet and smaller screens (768px and below) */
@media (max-width: 768px) {
    /* Main typography scaling */
    body {
        font-size: 0.95rem !important;
    }
    
    /* Hero sections */
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .hero-subtitle {
        font-size: 1.1rem !important;
        line-height: 1.6 !important;
    }
    
    /* Inline styled headings - Override specific font sizes */
    h2[style*="font-size: 2.2rem"] {
        font-size: 1.8rem !important;
    }
    
    h2[style*="font-size: 2.5rem"] {
        font-size: 2rem !important;
    }
    
    /* Featured section text */
    p[style*="font-size: 1.5rem"] {
        font-size: 1.2rem !important;
    }
    
    /* Card content */
    .card h2, .card h3 {
        font-size: 1.3rem !important;
    }
    
    .card p {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
    
    /* Gallery and filter text */
    .gallery-overlay h4 {
        font-size: 1rem !important;
    }
    
    .gallery-overlay p {
        font-size: 0.85rem !important;
    }
    
    /* Navigation text */
    .nav-link {
        font-size: 1rem !important;
    }
    
    /* Button text */
    .cta-button, .cta-button-small, .filter-btn {
        font-size: 0.95rem !important;
    }
    
    /* Footer text */
    .footer-section h3 {
        font-size: 1.2rem !important;
    }
    
    .footer-section p, .footer-section li {
        font-size: 0.9rem !important;
    }
}

/* Mobile screens (480px and below) */
@media (max-width: 480px) {
    /* Main typography scaling */
    body {
        font-size: 0.9rem !important;
    }
    
    /* Hero sections */
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }
    
    /* Inline styled headings - Override specific font sizes */
    h2[style*="font-size: 2.2rem"] {
        font-size: 1.5rem !important;
    }
    
    h2[style*="font-size: 2.5rem"] {
        font-size: 1.8rem !important;
    }
    
    /* Featured section text */
    p[style*="font-size: 1.5rem"] {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }
    
    /* Homepage featured grid responsive */
    .homepage-featured-grid[style*="grid-template-columns: 2fr 3fr"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Card content */
    .card h2, .card h3 {
        font-size: 1.2rem !important;
    }
    
    .card h4 {
        font-size: 1.1rem !important;
    }
    
    .card p {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }
    
    /* Gallery and filter text */
    .gallery-overlay h4 {
        font-size: 0.95rem !important;
    }
    
    .gallery-overlay p {
        font-size: 0.8rem !important;
    }
    
    /* Navigation text */
    .nav-link {
        font-size: 0.95rem !important;
    }
    
    .brand-name {
        font-size: 1rem !important;
    }
    
    /* Button text */
    .cta-button, .cta-button-small {
        font-size: 0.9rem !important;
        padding: 0.7rem 1.2rem !important;
    }
    
    .filter-btn {
        font-size: 0.85rem !important;
        padding: 0.6rem 0.8rem !important;
    }
    
    /* Footer text */
    .footer-section h3 {
        font-size: 1.1rem !important;
    }
    
    .footer-section p, .footer-section li {
        font-size: 0.85rem !important;
    }
    
    /* Modal text */
    .modal-caption h3 {
        font-size: 1.2rem !important;
    }
    
    .modal-caption p {
        font-size: 0.9rem !important;
    }
    
    /* Team member descriptions */
    .card .card p[style*="font-size: 1rem"] {
        font-size: 0.9rem !important;
    }
    
    /* Project descriptions */
    .card p[style*="font-size: 1.1rem"] {
        font-size: 1rem !important;
    }
}

/* Small mobile screens (360px and below) */
@media (max-width: 360px) {
    /* Main typography scaling */
    body {
        font-size: 0.85rem !important;
    }
    
    /* Hero sections */
    .hero-title {
        font-size: 1.6rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }
    
    /* Inline styled headings - Further reduction */
    h2[style*="font-size: 2.2rem"] {
        font-size: 1.3rem !important;
    }
    
    h2[style*="font-size: 2.5rem"] {
        font-size: 1.5rem !important;
    }
    
    /* Featured section text */
    p[style*="font-size: 1.5rem"] {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }
    
    /* Card content */
    .card h2, .card h3 {
        font-size: 1.1rem !important;
    }
    
    .card h4 {
        font-size: 1rem !important;
    }
    
    .card p {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
    }
    
    /* Gallery and filter text */
    .gallery-overlay h4 {
        font-size: 0.85rem !important;
    }
    
    .gallery-overlay p {
        font-size: 0.75rem !important;
    }
    
    /* Navigation text */
    .nav-link {
        font-size: 0.85rem !important;
    }
    
    .brand-name {
        font-size: 0.9rem !important;
    }
    
    /* Button text */
    .cta-button, .cta-button-small {
        font-size: 0.8rem !important;
        padding: 0.6rem 1rem !important;
    }
    
    .filter-btn {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.6rem !important;
    }
    
    /* Footer text */
    .footer-section h3 {
        font-size: 1rem !important;
    }
    
    .footer-section p, .footer-section li {
        font-size: 0.8rem !important;
    }
    
    /* Modal text */
    .modal-caption h3 {
        font-size: 1.1rem !important;
    }
    
    .modal-caption p {
        font-size: 0.8rem !important;
    }
    
    /* Counter text */
    .modal-counter span {
        font-size: 0.75rem !important;
    }
    
    /* Team member descriptions */
    .card .card p[style*="font-size: 1rem"] {
        font-size: 0.8rem !important;
    }
    
    /* Project descriptions */
    .card p[style*="font-size: 1.1rem"] {
        font-size: 0.9rem !important;
    }
}

/* Extra small screens (320px and below) */
@media (max-width: 320px) {
    /* Main typography scaling */
    body {
        font-size: 0.8rem !important;
    }
    
    /* Hero sections */
    .hero-title {
        font-size: 1.4rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.85rem !important;
    }
    
    /* Inline styled headings - Maximum reduction */
    h2[style*="font-size: 2.2rem"] {
        font-size: 1.1rem !important;
    }
    
    h2[style*="font-size: 2.5rem"] {
        font-size: 1.3rem !important;
    }
    
    /* Featured section text */
    p[style*="font-size: 1.5rem"] {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
    }
    
    /* Card content */
    .card h2, .card h3 {
        font-size: 1rem !important;
    }
    
    .card p {
        font-size: 0.8rem !important;
    }
    
    /* Gallery text */
    .gallery-overlay h4 {
        font-size: 0.8rem !important;
    }
    
    .gallery-overlay p {
        font-size: 0.7rem !important;
    }
    
    /* Button text */
    .filter-btn {
        font-size: 0.7rem !important;
        padding: 0.4rem 0.5rem !important;
    }
    
    /* Footer text */
    .footer-section h3 {
        font-size: 0.9rem !important;
    }
    
    .footer-section p, .footer-section li {
        font-size: 0.75rem !important;
    }
}

/* ========================================
   CARD LAYOUT AND WIDTH FIXES FOR SMALL SCREENS
   ======================================== */

/* Ensure cards never exceed main content width */
@media (max-width: 768px) {
    /* Override any grid minmax that might cause overflow */
    .main-content [style*="minmax"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Ensure all cards respect container width */
    .card {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Fix grid layouts that might cause overflow */
    [style*="grid-template-columns: repeat(auto-fit, minmax(400px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fit, minmax(250px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    /* Force single column layout for all grid containers */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Ensure main content has proper padding with visible background */
    .main-content {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    /* Fix donation amount buttons grid */
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
    
    [style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    
    /* Ensure donation buttons don't overflow */
    .donation-amount {
        font-size: 0.8rem !important;
        padding: 0.6rem 0.4rem !important;
        min-width: 0 !important;
    }
    
    /* Fix input fields on small screens */
    input[type="number"], input[type="email"] {
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 360px) {
    /* Extra padding reduction for very small screens but keep some background visible */
    .main-content {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* Reduce card padding to prevent overflow but keep some spacing */
    .card {
        padding: 0.9rem !important;
        margin: 0 !important;
    }
    
    /* Make buttons stack vertically on tiny screens */
    .donation-amount {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.3rem !important;
    }
    
    /* Ensure all grid gaps are small */
    [style*="gap: 3rem"] {
        gap: 1rem !important;
    }
    
    [style*="gap: 2rem"] {
        gap: 0.8rem !important;
    }
    
    [style*="gap: 1rem"] {
        gap: 0.5rem !important;
    }
}

@media (max-width: 320px) {
    /* Ultra small screen fixes */
    .main-content {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    
    .card {
        padding: 0.8rem !important;
    }
    
    /* Force all grids to single column */
    [style*="display: grid"] {
        display: block !important;
    }
    
    .card + .card {
        margin-top: 1rem !important;
    }
    
    /* Minimize all gaps */
    [style*="gap:"] {
        gap: 0.3rem !important;
    }
}





