/**
 * Homepage-only layout & mobile fixes
 * Loaded only on the front page (header-home / footer-home).
 */

/* ------------------------------------------------------------------
   Base: keep homepage sections stacked, not overlapping
------------------------------------------------------------------- */
body.home .main,
body.front-page .main,
body.home-layout .main {
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

body.home .main > section,
body.home .main > .tharwah-product-grid-container,
body.front-page .main > section,
body.front-page .main > .tharwah-product-grid-container,
body.home-layout .main > section,
body.home-layout .main > .tharwah-product-grid-container {
    position: relative;
    z-index: 1;
    clear: both;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

body.home .header-home,
body.home-layout .header-home {
    z-index: 100;
}

/* Title hero — keep clear of absolute header */
body.home .empowerment-section-v2:first-of-type,
body.home-layout .empowerment-section-v2:first-of-type {
    padding-top: 150px !important;
}

body.home .tharwah-product-grid-container ~ .empowerment-section-v2,
body.home-layout .tharwah-product-grid-container ~ .empowerment-section-v2 {
    padding-top: 50px !important;
}

/* ------------------------------------------------------------------
   Product grid / filter tabs
------------------------------------------------------------------- */
body.home .tharwah-product-grid-container,
body.home-layout .tharwah-product-grid-container {
    overflow: hidden;
}

/* Mobile: show mobile product carousel even if JS hasn't run yet */
body.home .mobile-product-swiper,
body.home-layout .mobile-product-swiper,
.mobile-product-swiper {
    /* base hidden on desktop handled below */
}

@media (max-width: 768px) {
    body.home .mobile-product-swiper,
    body.home-layout .mobile-product-swiper,
    .tharwah-product-grid-container .mobile-product-swiper {
        display: block !important;
    }

    body.home .product-grid.noon-style,
    body.home-layout .product-grid.noon-style,
    .tharwah-product-grid-container .product-grid.noon-style {
        display: none !important;
    }
}

@media (min-width: 769px) {
    body.home .mobile-product-swiper,
    body.home-layout .mobile-product-swiper,
    .tharwah-product-grid-container .mobile-product-swiper {
        display: none !important;
    }

    body.home .product-grid.noon-style,
    body.home-layout .product-grid.noon-style,
    .tharwah-product-grid-container .product-grid.noon-style {
        display: grid !important;
    }
}

/* Swiper must own the wrapper layout — override broken wrap rules */
body.home .product-grid-swiper,
body.home-layout .product-grid-swiper {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 8px 4px 24px !important;
}

body.home .product-grid-swiper .swiper-wrapper,
body.home-layout .product-grid-swiper .swiper-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    height: auto !important;
    max-height: none !important;
    box-sizing: border-box;
}

body.home .product-grid-swiper .swiper-slide,
body.home-layout .product-grid-swiper .swiper-slide {
    height: auto !important;
    margin-bottom: 0 !important;
    box-sizing: border-box;
}

body.home .product-grid-swiper .swiper-slide .product-card,
body.home-layout .product-grid-swiper .swiper-slide .product-card {
    height: 100%;
    max-width: 100%;
}

/* ------------------------------------------------------------------
   Mobile layout
------------------------------------------------------------------- */
@media (max-width: 768px) {
    body.home .empowerment-section-v2:first-of-type,
    body.home-layout .empowerment-section-v2:first-of-type {
        padding-top: 110px !important;
        padding-left: 0;
        padding-right: 0;
    }

    body.home .empowerment-section-v2 .empowerment-header,
    body.home-layout .empowerment-section-v2 .empowerment-header {
        padding: 0 16px;
        margin-bottom: 24px;
    }

    body.home .empowerment-section-v2 .empowerment-title,
    body.home-layout .empowerment-section-v2 .empowerment-title {
        font-size: 1.65rem;
        text-align: inherit;
        word-break: break-word;
    }

    body.home .empowerment-section-v2 .empowerment-subtitle,
    body.home-layout .empowerment-section-v2 .empowerment-subtitle {
        font-size: 0.95rem;
        text-align: inherit;
    }

    body.home .tharwah-product-grid-container,
    body.home-layout .tharwah-product-grid-container {
        padding: 12px 16px 24px;
        margin: 0;
    }

    body.home .product-grid-title,
    body.home-layout .product-grid-title {
        text-align: center;
        font-size: 1.35rem;
        line-height: 1.35;
        margin-bottom: 12px;
        padding: 0 4px;
    }

    body.home.rtl .product-grid-title,
    body.home [dir="rtl"] .product-grid-title,
    html[lang="ar"] body.home .product-grid-title,
    html[lang="ar"] body.home-layout .product-grid-title {
        text-align: center;
    }

    body.home .category-tabs-container.mobile,
    body.home-layout .category-tabs-container.mobile {
        display: block !important;
        margin: 8px 0 16px;
        padding: 0;
        overflow: hidden;
    }

    body.home .category-tabs-container.desktop,
    body.home-layout .category-tabs-container.desktop {
        display: none !important;
    }

    body.home .category-tabs-container.mobile .tab-item,
    body.home-layout .category-tabs-container.mobile .tab-item {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    body.home .mobile-product-swiper,
    body.home-layout .mobile-product-swiper {
        display: block;
        margin: 0;
        padding: 0;
    }

    body.home .product-grid.noon-style,
    body.home-layout .product-grid.noon-style {
        display: none !important;
    }

    body.home .product-card.noon-style,
    body.home .product-card.noon-style.compact,
    body.home-layout .product-card.noon-style,
    body.home-layout .product-card.noon-style.compact {
        height: auto !important;
        min-height: 280px;
        max-width: 100%;
    }

    /* Prevent carousel / partner rows from spilling */
    body.home .hero-carousel-wrapper,
    body.home .carousel-container,
    body.home .partners-slider,
    body.home .reviews,
    body.home .clients,
    body.home .gateway,
    body.home .services,
    body.home .company,
    body.home .solution,
    body.home .sustainable,
    body.home .faq,
    body.home-layout .hero-carousel-wrapper,
    body.home-layout .carousel-container,
    body.home-layout .partners-slider,
    body.home-layout .reviews,
    body.home-layout .clients,
    body.home-layout .gateway,
    body.home-layout .services,
    body.home-layout .company,
    body.home-layout .solution,
    body.home-layout .sustainable,
    body.home-layout .faq {
        overflow-x: hidden;
        max-width: 100%;
    }

    body.home .header-whatsapp,
    body.home .header-call,
    body.home-layout .header-whatsapp,
    body.home-layout .header-call {
        z-index: 90;
    }

    body.home .load-more-container,
    body.home-layout .load-more-container {
        display: none !important;
    }

    /* Avoid absolute children pulling following sections up */
    body.home .slider-marquee,
    body.home .numbers-section,
    body.home .empowerment-numbers,
    body.home-layout .slider-marquee,
    body.home-layout .numbers-section,
    body.home-layout .empowerment-numbers {
        position: relative;
        transform: none;
    }
}

@media (max-width: 480px) {
    body.home .empowerment-section-v2 .empowerment-title,
    body.home-layout .empowerment-section-v2 .empowerment-title {
        font-size: 1.4rem;
    }

    body.home .product-grid-title,
    body.home-layout .product-grid-title {
        font-size: 1.2rem;
    }

    body.home .category-tabs-container.mobile .tab-item,
    body.home-layout .category-tabs-container.mobile .tab-item {
        font-size: 12px;
        padding: 7px 14px;
    }
}

/* Desktop: ensure desktop tabs visible */
@media (min-width: 769px) {
    body.home .category-tabs-container.mobile,
    body.home-layout .category-tabs-container.mobile {
        display: none !important;
    }

    body.home .category-tabs-container.desktop,
    body.home-layout .category-tabs-container.desktop {
        display: block !important;
    }

    body.home .mobile-product-swiper,
    body.home-layout .mobile-product-swiper {
        display: none !important;
    }

    body.home .product-grid.noon-style,
    body.home-layout .product-grid.noon-style {
        display: grid !important;
    }
}
