/*
 * Adata_PromotionalBanner - frontend banner styles.
 * Moved out of the PHTML templates so the templates stay clean and this is
 * cached/maintained as a normal static asset. Loaded on the category page via
 * view/frontend/layout/catalog_category_view.xml.
 */

/* Shared: wrappers are positioning contexts for the nav arrows. */
.adata-promo-fullwidth,
.adata-promo-filtercolumn {
    position: relative;
}

/* ---------------------------------------------------------------------------
 * Full-width (main) banner
 * Centred, max 1500px wide. The container follows the original image's
 * 1500:250 (6:1) aspect ratio at desktop and tablet widths. A fixed 250px
 * height used to letterbox scaled-down banners, leaving empty space above
 * and below the visible image on tablets. Slides stack for cross-fading.
 *
 * Spacing: the "Shop By" product-list section that follows the banner
 * (section#product-list.py-8) already provides 32px (2rem) of top padding, so
 * the banner adds NO bottom margin of its own - relying on that existing
 * padding keeps the gap at exactly 2rem with no duplicate spacing. No top
 * margin on desktop. Tablet/mobile compensate for the theme-added top gap.
 * ------------------------------------------------------------------------- */
.adata-promo-fullwidth {
    margin: 0 auto;
    max-width: 1500px;
}

.adata-fw {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    aspect-ratio: 1500 / 250;
    height: auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: .375rem;
}

.adata-fw__slide {
    grid-area: 1 / 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity .6s ease;
    pointer-events: none;
}

.adata-fw__slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.adata-fw__slide,
.adata-fw__slide a,
.adata-fw__slide picture {
    display: block;
    width: 100%;
    height: 100%;
}

.adata-fw__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.adata-fw__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    opacity: 0;
    transition: opacity .3s;
    cursor: pointer;
}

.adata-promo-fullwidth:hover .adata-fw__nav {
    opacity: 1;
}

.adata-fw__nav--prev {
    left: 10px;
}

.adata-fw__nav--next {
    right: 10px;
}

/* ---------------------------------------------------------------------------
 * Filter-column (sidebar) banner
 * At most 320px wide, but can shrink to the actual sidebar width on tablets.
 * Keep the uploaded 320:500 aspect ratio so the image is not horizontally
 * clipped when the filter column is narrower than 320px. Slides stack for
 * the cross-fade. No nav arrows in the sidebar.
 * ------------------------------------------------------------------------- */
.adata-promo-filtercolumn,
.adata-promo-filtercolumn.my-4 {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 2rem 0;
    overflow: hidden;
}

.adata-fc {
    width: 100%;
    max-width: 320px;
    min-width: 0;
    aspect-ratio: 320 / 500;
    height: auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: .375rem;
}

.adata-fc__slide {
    grid-area: 1 / 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity .6s ease;
    pointer-events: none;
}

.adata-fc__slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.adata-fc__slide,
.adata-fc__slide a {
    display: block;
    width: 100%;
    height: 100%;
}

.adata-fc__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ---------------------------------------------------------------------------
 * Tablet + mobile (<=1199px)
 * Keep the desktop 2rem vertical spacing provided by the theme intact.
 * The category theme already puts a 2rem gap after breadcrumbs. Offset
 * 1rem of that space so the visible top gap is only 1rem, while keeping
 * 1rem left/right and bottom spacing around the banner.
 *
 * The filter-column banner has only one image asset. Use the mobile-style
 * fluid layout on tablets as well: its image determines the height, fits its
 * sidebar's available width, and is never cropped or cut off.
 * ------------------------------------------------------------------------- */
@media (max-width: 1199px) {
    /* .w-full is present in full_width.phtml; override the theme width utility
       explicitly so the side margins cannot cause overflow. The -1rem
       top margin cancels half the theme's 2rem gap above this banner. */
    .adata-promo-fullwidth,
    .adata-promo-fullwidth.w-full {
        box-sizing: border-box;
        width: calc(100% - 2rem);
        max-width: calc(100% - 2rem);
        margin: -1rem 1rem 1rem;
    }

    .adata-promo-filtercolumn,
    .adata-promo-filtercolumn.my-4 {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .adata-fc {
        width: 100%;
        max-width: 100%;
        aspect-ratio: auto;
        height: auto;
        display: block;
        overflow: visible;
        border-radius: 0;
    }

    .adata-fc__slide {
        grid-area: unset;
        position: relative;
        width: 100%;
        height: auto;
    }

    /* In a natural-height banner, only the active slide takes up space. */
    .adata-fc__slide:not(.is-active) {
        display: none;
    }

    .adata-fc__slide.is-active,
    .adata-fc__slide a {
        display: block;
        width: 100%;
        height: auto;
    }

    .adata-fc__slide img {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }
}

/* ---------------------------------------------------------------------------
 * Mobile (<=767px)
 * The full-width banner may switch to its separate mobile image via <picture>.
 * Remove the desktop 6:1 box so the image can use its natural aspect ratio.
 * The tablet+mobile margins above still apply.
 * ------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .adata-fw {
        width: 100%;
        max-width: 100%;
        aspect-ratio: auto;
        height: auto;
        display: block;
        overflow: visible;
        border-radius: 0;
    }

    .adata-fw__slide {
        grid-area: unset;
        position: relative;
        width: 100%;
        height: auto;
    }

    .adata-fw__slide:not(.is-active) {
        display: none;
    }

    .adata-fw__slide.is-active,
    .adata-fw__slide a,
    .adata-fw__slide picture {
        display: block;
        width: 100%;
        height: auto;
    }

    .adata-fw__slide img {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
    }
}