/* ============================================================
   Responsive Breakpoints
   ============================================================ */

/* Large Screens */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

/* Medium Screens / Tablets */
@media (max-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .two-col {
        grid-template-columns: 1fr;
    }

    .process-steps {
        flex-direction: column;
        align-items: center;
        gap: 32px;
    }

    .process-steps::before {
        display: none;
    }

    .pie-chart-container {
        flex-direction: column;
    }

    .hero h1 {
        font-size: 40px;
    }
}

/* Tablets / Small screens */
@media (max-width: 768px) {
    :root {
        --header-height: 70px;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--primary);
        flex-direction: column;
        padding: 80px 32px 32px;
        gap: 0;
        transition: right 0.3s ease;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    .nav-links.open {
        right: 0;
    }

    .nav-links a {
        padding: 14px 0;
        font-size: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        width: 100%;
    }

    .nav-links a::after {
        display: none;
    }

    .nav-login-btn {
        margin-top: 16px;
        width: 100%;
        justify-content: center;
    }

    .hamburger {
        display: flex;
        z-index: 1001;
    }

    .hero {
        padding-top: 80px;
        min-height: 100vh;
    }

    .hero-content {
        padding: 0 8px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    section {
        padding: 64px 0;
    }

    .section-header h2 {
        font-size: 28px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .org-branches {
        flex-direction: column;
        align-items: center;
    }

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

    .page-hero {
        padding: 120px 0 40px;
    }

    .filter-bar {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .modal-content {
        padding: 24px;
    }
}

/* Small Phones */
@media (max-width: 480px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0 16px;
    }

    .hero h1 {
        font-size: 28px;
    }

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

    .section-header h2 {
        font-size: 24px;
    }

    .btn {
        padding: 12px 24px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }

    .btn-lg {
        padding: 14px 28px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-item .stat-number {
        font-size: 32px;
    }

    .card {
        padding: 28px 20px;
    }

    .page-hero h1 {
        font-size: 28px;
    }

    .styled-table {
        font-size: 13px;
    }

    .styled-table th,
    .styled-table td {
        padding: 10px 12px;
    }
}

/* ============================================================
   Mobile catch-all overrides — neutralize inline styles in
   public pages (services, membership, about, leadership, etc.)
   that bypass the base responsive rules.
   ============================================================ */
@media (max-width: 768px) {

    /* Wide content tables — wrap in horizontal scroll automatically */
    .styled-table,
    section table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        max-width: 100%;
    }

    /* Inline multi-column grids → single column */
    [style*="grid-template-columns"][style*="px"],
    [style*="grid-template-columns"][style*="1fr 1fr"],
    [style*="grid-template-columns"][style*="2fr 1fr"],
    [style*="grid-template-columns"][style*="1fr 2fr"],
    [style*="grid-template-columns"][style*="repeat(2"],
    [style*="grid-template-columns"][style*="repeat(3"],
    [style*="grid-template-columns"][style*="repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    /* Hide oversized fixed-width inline widths */
    [style*="min-width: 6"],
    [style*="min-width:6"],
    [style*="min-width: 7"],
    [style*="min-width:7"],
    [style*="min-width: 8"],
    [style*="min-width:8"] {
        min-width: 0 !important;
    }

    /* Inline flex containers wrap by default */
    [style*="display:flex"],
    [style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    /* Soften big gaps and paddings on small screens */
    [style*="gap: 40px"],
    [style*="gap:40px"],
    [style*="gap: 60px"],
    [style*="gap:60px"] {
        gap: 16px !important;
    }

    [style*="padding: 60px"],
    [style*="padding:60px"] {
        padding: 28px !important;
    }
}

@media (max-width: 480px) {
    /* Touch-friendly buttons across the board */
    .btn-sm {
        padding: 10px 16px;
        font-size: 13px;
    }

    /* Section headers — center on phone */
    .section-header h2 {
        line-height: 1.2;
    }

    /* News cards: image height shrink */
    .news-card-image img {
        height: 160px !important;
    }
}

/* ============================================================
   MOBILE HARD GUARDS — prevent horizontal scroll on phones.
   ============================================================ */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
}

body {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

@media (max-width: 768px) {
    [style*="width:"],
    [width] {
        max-width: 100% !important;
    }

    code, kbd, samp {
        word-break: break-all;
        white-space: normal !important;
    }
}