.carousel-container:not(:has(div)) {
    display: none!important;
}


/* Homepage banner ads */
/* ------------------------------------------------------------------------------------------ */
.ms-section--advertising {
    display: flex!important; /* Helps in centering the link container */
    justify-content: center; /* Horizontally centers the banner */
}

.ms-section--advertising-section {
    display: flex !important;

    justify-content: center;

}

.ms-section--advertising:has(div[style*='display: none']) {
    display: none; 
}

.ms-section--advertising-overhead:has(div[style*='display: none']) {
    display: none;
}

.ms-section--advertising-header:has(div[style*='display: none']) {
    display: none;
}

.ms-section--advertising-footer:has(div[style*='display: none']) {
    display: none;
}

.ms-section--advertising.none {
    /* Set to a large enough value to accommodate all content */
    height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    /* Adjust this value */
}

.ms-section--advertising .gh-container {
    display: flex;
    justify-content: center;
}
.ms-section--advertising-overhead {
    display: flex;
    padding-top: 10px;
    padding-bottom: 24px;
    /* Set height and max-height is sitewide code inject */
    /*  height: 250px;
    max-height: 400px;*/
    overflow: hidden;
    /* Add a smooth transition */
    transition: height 0.01s, padding 0.01s;

}

.ms-section--advertising-header {
    display: flex;
    justify-content: center;
    margin: 24px auto;
    /* Set height and max-height is sitewide code inject */
    /*  height: 250px;
    max-height: 400px;*/
    overflow: hidden;
    /* Add a smooth transition */
    transition: height 0.5s ease-in-out, padding-top 0.5s ease-in-out;

}

.ms-section--advertising-footer {
    display: flex;
    padding-bottom: 24px;
    /* Set height and max-height is sitewide code inject */
    /*  height: 250px;
    max-height: 400px;*/
    overflow: hidden;
    /* Add a smooth transition */
    transition: height 0.5s ease-in-out, padding-bottom 0.5s ease-in-out;


}


/* This is the new link container */
.ms-banner-link-container {
    position: relative; /* Essential for positioning the text overlay */
    display: inline-block; /* Makes the container shrink to the image size */
    text-decoration: none;
    line-height: 0; /* Prevents extra space below the image */
}

.ms-banner-link-container-mobile {
    display:none;

}

/* This styles the image itself */
.ms-banner-image {
    display: block; /* Removes any extra space below the image */
    max-width: 100%; /* Ensures the image is responsive */
    height: auto;
    /* max-height: 250px; */
}

/* This wrapper becomes the overlay for text */
.ms-banner-advertising__wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: initial;
    box-sizing: border-box;
    padding: 48px 48px 52px;
}

.ms-banner-advertising__title {
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: 30px;
    font-weight: 700;
    line-height: 110%;
    letter-spacing: -0.035em;
    position: relative;
    max-width: 460px; /* Constrain the width of the title */
}

/* Styles for the "button" element */
.ms-banner-advertising__link {
    padding: 6px 20px;
    height: 40px;
    width: fit-content;
    background-color: var(--accent-color);
    border-radius: var(--border-radius-buttons);
    position: relative;
    display: flex;
    align-items: center;
}

.ms-banner-advertising__link:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

.ms-banner-advertising__link span {
    position: relative;
    z-index: 5;
    color: #fff;
    font-family: var(--font-family-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.hash-footer-ad-banner {
    padding-bottom: 64px;
}



@media (max-width: 899px) {
    .ms-banner-image-responsive {
        width: 100%;
        height: 250px;
        object-fit: cover; /* This crops the image to fill the space */
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 34px;
    }
}

/* Section post ads */
/* ------------------------------------------------------------------------------------------ */
.ms-post-column--advertising {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    flex-direction: column;
}

.ms-panel-image {
    display: block;
    height: fit-content;
    width: 300px;
    max-width: 100%;
}

.ms-mrec-image {
    display: block;
    /* Removes any extra space below the image */
    max-width: 100%;
    /* Ensures the image is responsive */
    height: auto;
    max-height: 250px;
}

.ms-hpu-image {
    display: block;
    width: 250px;
    height: auto;
    max-height: 100%;
}

.ms-ad-panel-centre-all {
    height: 100%;
    justify-content: center;
    align-items: center;
}

.ms-ad-panel-centre-v {
    height: 100%;
    justify-content: center;
}

.ms-ad-panel-centre-h {
    align-items: center;
}

.ms-ad-bottom-border {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 16px;
}

.ms-ad-left-padding-24px {
    padding-left: 24px;
}

@media (max-width:1000px) {
   /*  .ms-post-column--advertising {
        padding-top:16px;

    } */

    .ms-post-column--advertising .ms-ad-panel-centre-h {
        justify-content: center;
    }

    .ms-panel-image {
        width: 300px!important;
    }
}


/* Post sidebar ads */
/* ------------------------------------------------------------------------------------------ */
.ms-sidebar-advertising--bg {
    background-color: #f0f0f0;
    background-size: cover;
    background-position: center center;
    /* padding: 47px 35px; */
    height: 100%;
    align-content: center;
    padding-left: 2em;
    padding-right: 2em
}

.ms-sidebar-custom--bg {
    width: 100%;
    min-height: 465px;
}

.ms-sidebar-mrec--bg {
    width: 300px;
    height: 250px;
}

.ms-sidebar-halfpage--bg {
    width: 300px;
    height: 600px;
}

.ms-sidebar-skyscraper--bg {
    width: 160px;
    height: 600px;
}

.ms-sidebar-advertising__wrapper{
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ms-sidebar-custom-ad__link {
    display: flex;
    justify-content: center;
    text-decoration: none; /* Removes underline from the whole block */
    color: inherit; /* Ensures text inside inherits its color */
    width: 100%;
}

.ms-sidebar-advertising__title{
    color: #FFF;
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 110%;
    letter-spacing: -0.035em;

    position: relative;
    z-index: 5;
}

.ms-sidebar-advertising__link{
    padding: 6px 20px;

    height: 2.5em;
    width: fit-content;

    background-color: var(--accent-color);
    border-radius: 2px;

    position: relative;

    display: flex;
    align-items: center;
}

.ms-sidebar-advertising__link span {
    position: relative;
    z-index: 5;

    color: #FFF;
    font-family: Fira Sans;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.ms-sidebar-advertising__link::after {
    content: '';

    border-radius: 2px;;

    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    border: 0;

    width: 100%;
    height: 100%;

    background-color: transparent;
    transition: background-color .25s ease;
    z-index: 0;
}

.ms-sidebar-advertising__link:hover {
    opacity:0.8;
}

.ms-sidebar-custom-ad {
    position: sticky;
    animation: fadeIn 1s ease-in-out;
    transition: top 0.45s ease;
    margin-top: 32px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.ms-sidebar-custom-ad.with-big-header {
    top: 152px;
}
.ms-sidebar-custom-ad.with-small-header {
    top: 60px;
}
.ms-sidebar-custom-ad.moved {
    top: 32px;
}


.ms-ad-inline {
    justify-content: center;
}

.ms-ad-inline:has(div[style*='display: none']) {
    display: none;
}

.ms-inline-image {
    display: block;
    max-width: 100%;
    -o-object-fit: contain;
    object-fit: contain;
    width: 300px;
    
}

.ms-ad-sidebar-container {
    display: flex;
    max-height: 600px;
    justify-self: center;
    /* width: 300px; */
    width: fit-content;
    justify-content: center;
    align-items: flex-start;
    padding-top: 24px;

}

.ms-sidebar-image-vert {
    display: block;
    height: 100%;
    width: auto;
}

.ms-sidebar-image-square {
    display: block;
    height: auto;
    width: 100%;
}

.ms-sidebar-image {
    display: block;
    height: 100%;
    width: 100%;
    object-fit: contain;
}

/* Carousel Ads */
/* ------------------------------------------------------------------------------------------ */

/* Carousel Container */
.carousel-container {
    margin: 0 auto;
    position: relative;
    overflow: hidden;

    /* --- CHANGES: Removed padding hack. Height will be set by JS dynamically. --- */
    height: auto;
    /* Initial state, will be overwritten by JS */
    transition: height 1s ease-in-out;
    /* Smooth transition for height changes */
}

/* Slides (Images) */
.carousel-item {
    position: absolute;
    inset: 0;
    display: none;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    /* Crucial: Must be relative to allow measuring its height */
    position: relative;
    /* Reset positioning for all except the active slide to avoid overlap issues during height calc */
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
}

/* The active slide is the only one truly visible and positioned by JS for height calculation */
.carousel-item.carousel-active {
    display: block;
    opacity: 1;
    /* Reset positioning for the active slide so it dictates parent height */
    position: relative;
}

/* Non-active slides must be absolutely positioned again so they don't appear in the layout flow */
.carousel-item:not(.carousel-active) {
    position: absolute;
}

.carousel-item img {
    width: 100%;
    height: auto;
    /* Let the image size itself based on width */
    object-fit: cover;
    display: block;
    /* Important for removing small space below image */
}

/* Show buttons on container hover */
.carousel-container:hover {
    opacity: 1;
}


@media (max-width: 1100px){
    .ms-sidebar-advertising--bg{
        min-height: 100%;
    }
        .ms-section--advertising-header,
        .ms-section--advertising-footer,
        .ms-section--advertising-overhead {
            padding: 0 10px;
        }
}

@media (max-width: 550px) {
    
    .carousel-active:has(.ms-banner-link-container-mobile) {
        & .ms-banner-link-container:not(.ms-banner-link-container-mobile) {
            display: none;
        }
    
        & .ms-banner-link-container-mobile {
            display: inline-block;   
        }
        & .advertisement-container {
            padding-bottom: 0;
        }
    }
    .ms-section--advertising-header {
        margin:0
    }
    
}

@media (max-width: 500px){
    .ms-sidebar-advertising__wrapper{
        align-items: center;
    text-align: center;
    }
}