/* Frontend navigation and responsive homepage fixes */
.j2m-site .main-nav .nav-menu,
.j2m-site .main-nav .nav-menu li,
.j2m-site .main-nav .nav-menu a,
.j2m-site .main-nav .nav-search {
    position:relative;
    z-index:1061;
    pointer-events:auto;
}
.j2m-site .main-nav.show .nav-menu a {
    pointer-events:auto !important;
    cursor:pointer;
    touch-action:manipulation;
}
@media (max-width:992px) {
    .j2m-home .latest-grid,
    .j2m-home .health-grid,
    .j2m-home .category-post-grid,
    .j2m-home .trending-post-grid,
    .j2m-home .editors-grid {
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }
    .j2m-home .home-left,
    .j2m-home .home-right {
        display:none !important;
    }
    .j2m-home .home-shell {
        grid-template-columns:minmax(0,1fr) !important;
    }
    .j2m-home .home-main {
        width:100% !important;
        min-width:0 !important;
    }
    .j2m-home .quick-tips-section,
    .j2m-home .home-newsletter-section,
    .j2m-home .about-home-section,
    .j2m-home .faq-home-section,
    .j2m-home .home-more-content {
        display:none !important;
    }
    .j2m-home .most-viewed-section {
        display:block !important;
    }
    .j2m-home .footer-top,
    .j2m-site.j2m-inner .footer-top {
        display:none !important;
    }
    .j2m-site .footer-bottom {
        margin-top:0 !important;
    }
}
@media (max-width:560px) {
    .j2m-home .latest-grid,
    .j2m-home .health-grid,
    .j2m-home .category-post-grid,
    .j2m-home .trending-post-grid,
    .j2m-home .editors-grid {
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }
    .j2m-home .home-card-body,
    .j2m-home .health-card-body,
    .j2m-home .category-post-body,
    .j2m-home .editor-pick-body {
        padding:11px !important;
    }
    .j2m-home .home-card-body h3,
    .j2m-home .health-card-body h3,
    .j2m-home .category-post-body h3,
    .j2m-home .editor-pick-body h3 {
        font-size:14px !important;
        line-height:1.35 !important;
    }
    .j2m-home .category-post-body p,
    .j2m-home .editor-pick-body p {
        font-size:11px !important;
        line-height:1.45 !important;
    }
    .j2m-home .card-meta {
        font-size:9px !important;
    }
    .j2m-home .most-viewed-section {
        display:block !important;
    }
}

/* Homepage section layout: 6 desktop, 4 tablet/mobile */
@media (min-width:993px) {
    .j2m-home .latest-grid,
    .j2m-home .health-grid,
    .j2m-home .category-post-grid,
    .j2m-home .trending-post-grid,
    .j2m-home .editors-grid {
        grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    }
}
@media (min-width:561px) and (max-width:992px) {
    .j2m-home .latest-grid,
    .j2m-home .health-grid,
    .j2m-home .category-post-grid,
    .j2m-home .trending-post-grid,
    .j2m-home .editors-grid {
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }
    .j2m-home .latest-grid > :nth-child(n+5),
    .j2m-home .health-grid > :nth-child(n+5),
    .j2m-home .category-post-grid > :nth-child(n+5),
    .j2m-home .trending-post-grid > :nth-child(n+5),
    .j2m-home .editors-grid > :nth-child(n+5) {
        display:none !important;
    }
}
@media (max-width:560px) {
    .j2m-home .latest-grid,
    .j2m-home .health-grid,
    .j2m-home .category-post-grid,
    .j2m-home .trending-post-grid,
    .j2m-home .editors-grid {
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }
    .j2m-home .latest-grid > :nth-child(n+5),
    .j2m-home .health-grid > :nth-child(n+5),
    .j2m-home .category-post-grid > :nth-child(n+5),
    .j2m-home .trending-post-grid > :nth-child(n+5),
    .j2m-home .editors-grid > :nth-child(n+5) {
        display:none !important;
    }
}

/* Mobile navigation: keep the drawer and its category links above the backdrop. */
@media (max-width:992px) {
    .j2m-site .site-header {
        position:relative !important;
        z-index:1400 !important;
    }
    .j2m-site .mobile-nav-backdrop {
        z-index:1300 !important;
        pointer-events:none !important;
    }
    .j2m-site.mobile-nav-open .mobile-nav-backdrop {
        pointer-events:auto !important;
    }
    .j2m-site .main-nav.show {
        z-index:1450 !important;
        pointer-events:auto !important;
        touch-action:auto !important;
        visibility:visible !important;
        opacity:1 !important;
    }
    .j2m-site .main-nav.show .nav-menu,
    .j2m-site .main-nav.show .nav-menu li,
    .j2m-site .main-nav.show .nav-menu a,
    .j2m-site .main-nav.show .nav-search {
        position:relative !important;
        z-index:1451 !important;
        pointer-events:auto !important;
        touch-action:manipulation !important;
    }
    .j2m-site .main-nav.show .nav-menu a {
        cursor:pointer !important;
        -webkit-tap-highlight-color:rgba(46,139,87,.12);
    }
}

/* Center the site logo on mobile devices only. */
@media (max-width:992px) {
    .j2m-site .site-header .header-main {
        position:relative !important;
        min-height:72px;
        display:flex !important;
        align-items:center !important;
        justify-content:center !important;
    }
    .j2m-site .site-header .site-logo {
        position:absolute !important;
        left:50% !important;
        top:50% !important;
        transform:translate(-50%,-50%) !important;
        display:flex !important;
        align-items:center !important;
        justify-content:center !important;
        width:auto !important;
        max-width:70% !important;
        margin:0 !important;
        z-index:1405 !important;
    }
    .j2m-site .site-header .site-logo img {
        display:block !important;
        width:auto !important;
        max-width:190px !important;
        max-height:58px !important;
        height:auto !important;
        object-fit:contain !important;
    }
    .j2m-site .site-header .logo-fallback {
        text-align:center !important;
        white-space:nowrap;
    }
    .j2m-site .site-header .mobile-menu-btn {
        position:relative !important;
        z-index:1410 !important;
        margin-left:auto !important;
    }
}

@media (max-width:560px) {
    .j2m-site .site-header .header-main {
        min-height:68px;
    }
    .j2m-site .site-header .site-logo img {
        max-width:175px !important;
        max-height:54px !important;
    }
}
