/* ============================================================
   Homepage / landing — responsive polish (mobile → desktop)
   Scoped to .page-home where possible; safe overrides only.
   ============================================================ */

/* Site-wide --site-edge / --site-max + container width live in header-ref.css
   (always-on). Keeping them here again would re-break non-home pages if this
   file stays home-gated. */

/* ---- Base: prevent horizontal bleed on small screens ---- */
.page-home .aiz-main-wrapper {
    overflow-x: visible;
}

.page-home .aiz-main-wrapper > header {
    flex-shrink: 0;
}

.page-home .home-banner-area--full,
.page-home #section_featured,
.page-home .allp--home {
    overflow-x: clip;
}

.page-home .container {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
}

@media (min-width: 768px) {
    .page-home .container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
}

@media (min-width: 992px) {
    .page-home #section_featured .trend-sec,
    .page-home .allp--home {
        padding-top: 8px;
    }

    .page-home .allp--home .allp-grid {
        gap: 20px 16px;
    }
}

@media (min-width: 992px) {
    .page-home .allp--home .allp-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .page-home .allp--home .allp-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 22px 18px;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .page-home .allp--home .allp-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px 12px;
    }
}

/* ---- Hero: full-bleed editorial layout ---- */
.page-home {
    --home-header-h: 108px;
}

.page-home .home-banner-area--full {
    margin-bottom: 0 !important;
}

.page-home .home-banner-area--full + * {
    margin-top: 0.75rem;
}

/* Mobile / tablet — inset rounded hero (not edge-to-edge) */
@media (max-width: 991.98px) {
    .page-home .home-banner-area--full {
        margin-top: 10px !important;
        margin-bottom: 0.75rem !important;
        padding-left: max(16px, env(safe-area-inset-left)) !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
        background: transparent !important;
        box-sizing: border-box;
    }

    .page-home .home-promo--full {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box;
    }

    .page-home .home-promo__hero--full {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        border-radius: 16px !important;
        overflow: hidden !important;
        background: transparent !important;
        isolation: isolate;
    }

    .page-home .home-promo__carousel--editorial,
    .page-home .home-promo__carousel--editorial .slick-list,
    .page-home .home-promo__carousel--editorial .slick-track,
    .page-home .home-promo__carousel--editorial .slick-slide,
    .page-home .home-promo__carousel--editorial .slick-slide > div,
    .page-home .home-promo__carousel--editorial .carousel-box,
    .page-home .home-promo__slide--full,
    .page-home .home-promo__media {
        border-radius: 16px !important;
        overflow: hidden;
    }

    .page-home .home-promo__slide--full {
        line-height: 0;
    }

    .page-home .home-promo__media {
        background: transparent;
    }

    .page-home .home-promo__overlay {
        display: none !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .page-home .home-promo__carousel--editorial .slick-list {
        padding: 0 !important;
        margin: 0 !important;
    }

    .page-home .home-promo__img--full,
    .page-home .home-promo__carousel--editorial .slick-slide img {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        object-fit: initial !important;
        object-position: center center;
        border-radius: 16px !important;
        display: block;
    }
}

@media (max-width: 575.98px) {
    .page-home .home-banner-area--full {
        margin-top: 8px !important;
        padding-left: max(12px, env(safe-area-inset-left)) !important;
        padding-right: max(12px, env(safe-area-inset-right)) !important;
    }

    .page-home .home-promo__hero--full,
    .page-home .home-promo__carousel--editorial,
    .page-home .home-promo__carousel--editorial .slick-list,
    .page-home .home-promo__carousel--editorial .slick-track,
    .page-home .home-promo__carousel--editorial .slick-slide,
    .page-home .home-promo__carousel--editorial .slick-slide > div,
    .page-home .home-promo__carousel--editorial .carousel-box,
    .page-home .home-promo__slide--full,
    .page-home .home-promo__media,
    .page-home .home-promo__img--full,
    .page-home .home-promo__carousel--editorial .slick-slide img {
        border-radius: 12px !important;
    }
}

@media (min-width: 992px) {
    .page-home .home-banner-area--full,
    .page-home .home-promo--full {
        overflow: hidden;
    }

    .page-home .home-banner-area--full {
        background: #000;
    }

    .page-home .home-promo__hero--full {
        height: var(--home-hero-h, calc(100dvh - var(--home-header-h, 108px)));
        min-height: var(--home-hero-h, calc(100dvh - var(--home-header-h, 108px)));
    }

    .page-home .home-promo__carousel--editorial,
    .page-home .home-promo__carousel--editorial .slick-list,
    .page-home .home-promo__carousel--editorial .slick-track,
    .page-home .home-promo__carousel--editorial .slick-slide,
    .page-home .home-promo__carousel--editorial .slick-slide > div,
    .page-home .home-promo__carousel--editorial .carousel-box,
    .page-home .home-promo__slide--full,
    .page-home .home-promo__media {
        height: 100% !important;
        min-height: 100% !important;
    }

    .page-home .home-promo__slide--full {
        position: relative;
    }

    .page-home .home-promo__media {
        position: absolute;
        inset: 0;
    }

    .page-home .home-promo__img--full,
    .page-home .home-promo__carousel--editorial .slick-slide img {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        object-fit: cover !important;
        object-position: center center;
        image-rendering: auto;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

@media (min-width: 992px) and (prefers-reduced-motion: reduce) {
    .page-home .home-banner-area--full {
        transition: none !important;
    }
}

@media (min-width: 992px) {
    .page-home .home-promo--full,
    .page-home .home-promo__hero--full,
    .page-home .home-promo__slide--full,
    .page-home .home-promo__media,
    .page-home .home-promo__img--full,
    .page-home .home-promo__carousel--editorial .slick-list,
    .page-home .home-promo__carousel--editorial .slick-slide {
        border-radius: 0 !important;
    }
}

/* ---- Legacy hero + side rail (removed from reclassic; kept for safety) ---- */
.page-home .home-slider {
    max-width: 100% !important;
    flex: 1 1 100%;
    min-width: 0;
}

@media (min-width: 1200px) {
    .page-home .home-banner-area:not(.home-banner-area--full) .home-slider {
        max-width: calc(100% - var(--side-rail-width, 248px) - 10px) !important;
        flex: 1 1 auto;
        min-width: 0;
        padding-left: 10px;
    }

    .page-home .home-banner-area:not(.home-banner-area--full) .aiz-category-menu .sub-cat-menu {
        width: calc(100% - var(--side-rail-width, 248px) - 10px);
        left: calc(var(--side-rail-width, 248px) + 10px);
    }
}

.page-home .home-banner-area:not(.home-banner-area--full) {
    margin-bottom: 0.75rem !important;
}

.page-home .home-banner-area > .container > .d-flex {
    gap: 0;
}

@media (max-width: 1199.98px) {
    .page-home .home-banner-area:not(.home-banner-area--full) > .container {
        padding-left: max(12px, env(safe-area-inset-left)) !important;
        padding-right: max(12px, env(safe-area-inset-right)) !important;
    }

    .page-home .home-promo__hero:not(.home-promo__hero--full) {
        border-radius: 12px;
    }
}

@media (max-width: 575.98px) {
    .page-home .home-banner-area:not(.home-banner-area--full) {
        margin-top: 8px !important;
    }

    .page-home .home-promo__hero:not(.home-promo__hero--full) {
        border-radius: 10px;
    }
}

/* ---- Flash deal ---- */
.page-home #flash_deal .flash-deal-header {
    gap: 8px;
}

.page-home #flash_deal .flash-deal-links {
    width: 100%;
}

.page-home #flash_deal .flash-deal-links__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}

.page-home #flash_deal .flash-deal-links__divider {
    display: none;
}

@media (min-width: 576px) {
    .page-home #flash_deal .flash-deal-links__divider {
        display: inline-block;
        width: 1px;
        height: 14px;
        background: rgba(0, 0, 0, 0.12);
        flex-shrink: 0;
    }
}

.page-home #flash_deal .flash-deal-banner-col {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    margin-bottom: 12px;
}

.page-home #flash_deal .flash-deal-banner {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    aspect-ratio: 4 / 5;
    height: auto !important;
    min-height: 0;
}

@media (min-width: 768px) {
    .page-home #flash_deal .flash-deal-banner-col {
        flex: 0 0 auto;
        width: auto;
        max-width: none;
        margin-bottom: 0;
    }

    .page-home #flash_deal .flash-deal-banner {
        width: 200px;
        max-width: none;
        aspect-ratio: auto;
        height: 200px !important;
    }
}

@media (min-width: 992px) {
    .page-home #flash_deal .flash-deal-banner {
        width: 280px;
        height: 280px !important;
    }
}

.page-home #flash_deal .flash-deal-products-col {
    min-width: 0;
    flex: 1 1 auto;
}

.page-home #section_home_categories .slick-slider .slick-list .slick-slide {
    margin-bottom: -4px;
}

.page-home .home-category-banner .home-category-name {
    bottom: -40px;
}

@media (max-width: 991.98px) {
    .page-home #section_home_categories .home-cat-row {
        flex-direction: column;
        align-items: stretch;
    }

    .page-home #section_home_categories .home-cat-banner-col {
        width: 100% !important;
        max-width: 100%;
        flex: 0 0 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 12px;
    }

    .page-home #section_home_categories .home-cat-banner-box {
        width: 100% !important;
        max-width: 280px;
        height: auto !important;
        aspect-ratio: 5 / 6;
        margin-left: auto;
        margin-right: auto;
    }

    .page-home #section_home_categories .home-cat-products-col {
        width: 100% !important;
        max-width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ---- Trending / featured (AJAX) ---- */

/* ---- All Products on home ---- */
@media (max-width: 991.98px) {
    .page-home .allp--home {
        padding-top: 4px;
        padding-bottom: 24px;
    }

    .page-home .allp--home .allp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 10px;
    }

    .page-home .allp--home .allp__toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
        margin-left: -4px;
        margin-right: -4px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .page-home .allp--home .allp__toolbar::-webkit-scrollbar {
        display: none;
    }

    .page-home .allp--home .allp-chip {
        flex-shrink: 0;
    }
}

@media (max-width: 575.98px) {
    .page-home .allp--home .allp__title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .page-home .allp--home .allp__count {
        white-space: normal;
    }
}

/* ---- Promo banner carousels ---- */
.page-home .aiz-carousel .carousel-box img {
    max-width: 100%;
    height: auto;
}

/* ---- Mobile bottom nav: handled in mobile-bottom-nav.css ---- */

/* ---- Section rhythm on home ---- */
.page-home #section_featured:empty,
.page-home #section_home_categories:empty {
    display: none;
}

.page-home #flash_deal,
.page-home #section_featured .trend-sec,
.page-home .allp--home {
    scroll-margin-top: 72px;
}

@media (min-width: 992px) {
    .page-home #section_featured .trend-sec__carousel-wrap {
        padding-left: 0;
        padding-right: 0;
    }

    .page-home #section_featured .trend-sec__nav--prev {
        left: -4px;
    }

    .page-home #section_featured .trend-sec__nav--next {
        right: -4px;
    }

    .page-home .trend-sec__title,
    .page-home .allp--home .allp__title {
        font-size: clamp(18px, 1.35vw, 22px);
    }
}

@media (max-width: 991.98px) {
    .page-home #flash_deal .aiz-count-down {
        flex-wrap: wrap;
    }
}

@media (max-width: 575.98px) {
    .page-home #flash_deal .rounded-2.overflow-hidden {
        padding: 12px !important;
    }

    .page-home #flash_deal .fs-22 {
        font-size: 18px !important;
    }
}
