﻿
/*#region Gated*/

body:has(article.full-gated-content) .mims-footer-gated-content {
    display: block !important;
}

body:has(article.partial-gated-content) .mims-footer-gated-content {
    display: block !important;
}

body:has(div.control-section.full-gated-content) .mims-footer-gated-content {
    display: block !important;
}

body:has(article.full-gated-content) .mims-footer-content {
    display: none !important;
}

body:has(article.partial-gated-content) .mims-footer-content {
    display: none !important;
}

.partial-gated-content > .disease-content:has(#disease-algorithm-diagram):after {
    height: 100% !important;
}

/*#endregion*/

@media (max-width: 1023.98px) {

    /*#region Gated*/
    .msp-content-body-section:has(article.partial-gated-content) .msp-primesighttop-container {
        display: none !important;
    }

    .msp-content-body-section:has(article.full-gated-content) .msp-primesighttop-container {
        display: none !important;
    }

    body:has(article.full-gated-content) .mims-footer {
        position: relative;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1029;
    }

    body:has(article.partial-gated-content) .mims-footer {
        position: relative;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 1029;
    }


    .full-gated-content {
        position: relative;
        overflow: hidden;
        text-overflow: clip;
        height: 30vh;
        overflow-y: auto;
    }

    .full-gated-content:after {
        content: '';
        width: 100%;
        height: calc(100% - 10px);
        position: absolute;
        left: 0;
        bottom: 0;
        -webkit-filter: blur(4px);
        -moz-filter: blur(4px);
        filter: blur(4px);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .partial-gated-content > .disease-content:after, .partial-gated-content > .article-content:after {
        height: calc(100% - 220px) !important;
    }

    /* 285px until mims-specialty.js sizes the content to reach the sign-up bar (its !important height wins over this
       one), so a tall tablet viewport is not left with a white gap under the bar. 285px stays the floor. */
    .partial-gated-content > .article-content, .partial-gated-content > .disease-content {
        height: 285px;
        min-height: 285px !important;
    }

    /* Disease pages start near the height the script will give them: the viewport less the ~430px above the content
       (measured 387-464px, by title length) and the 270px below it (MSP-2306 sign-up bar 254px + 16px; was 247px). The bar
       then barely moves when the script runs after hydration, instead of jumping by up to ~480px on a tall tablet. News
       pages vary too much above the content to guess, and barely grow. The script's !important height still decides;
       285px stays the floor. */
    .partial-gated-content > .disease-content {
        height: max(285px, calc(100svh - 700px));
    }
    /*#endregion*/

}

/* Below 768px the content starts ~40px higher (measured 387-410px); the 270px below it is the same as on tablets. */
@media (max-width: 767.98px) {
    .partial-gated-content > .disease-content {
        height: max(285px, calc(100svh - 660px));
    }
}

/* Below 360px the sign-up title wraps and the bar is 278px, 24px taller. */
@media (max-width: 359.98px) {
    .partial-gated-content > .disease-content {
        height: max(285px, calc(100svh - 684px));
    }
}

/* Paywall: the content grows to reach the sign-up bar, but no more gated text shows than under the old 520px cap. The
   blurred overlay fades to the page background from 460px into the content and covers it fully from 520px. (A mask on the
   content would make it the backdrop root and the blur would stop working.) The partial overlay starts 220px down, the
   full-gated one 10px down. */
.partial-gated-content > .disease-content:after, .partial-gated-content > .article-content:after {
    background-image: linear-gradient(to bottom, transparent 240px, var(--mimsLightGray) 300px);
}

.msp-body-content-container > .full-gated-content:after {
    background-image: linear-gradient(to bottom, transparent 450px, var(--mimsLightGray) 510px);
}

/* 8px wider each side: the overlay's own blur softens its edges and let slivers of text show along them. */
.partial-gated-content > .disease-content:after, .partial-gated-content > .article-content:after,
.msp-body-content-container > .full-gated-content:after {
    left: -8px;
    width: calc(100% + 16px);
}

/* Desktop: ~455px above the content and 99px below it once filled (the side column is shorter than the filled content). */
@media (min-width: 1024px) {
    .partial-gated-content > .disease-content {
        height: max(220px, calc(100svh - 554px));
    }
}

/* The sign-up bar is 99px from 992px wide, as on wider desktops (MSP-2306 panel; 178px before). */
@media (min-width: 992px) and (max-width: 1023.98px) {
    .partial-gated-content > .disease-content {
        height: max(285px, calc(100svh - 529px));
    }
}

@media (min-width: 1024px) {

    .msp-body-content-container .full-gated-content {
        height: 260px;
        overflow: hidden;
    }

        .msp-body-content-container .full-gated-content * {
            height: 100%;
        }

    body:has(article.full-gated-content) .mims-footer {
        bottom: 0;
        height: 100%;
        width: 100%;
        top: calc(100vh - 100px);
        z-index: 1029;
    }

    body:has(article.partial-gated-content) .mims-footer {
        bottom: 0;
        height: 100%;
        width: 100%;
        top: calc(100vh - 100px);
        z-index: 1029;
    }

    .article-content-body-container:has(.partial-gated-content) {
        padding-bottom: 0 !important;
    }

    .article-content-body-container:has(.full-gated-content) {
        padding-bottom: 0 !important;
    }

}