/*
 * News detail mixed-media frame.
 * Swiper moves media inside one stable outer mask; the mask alone changes shape.
 */

html[data-understar-page-kind="news-detail"] {
    --us-news-frame-motion: 560ms;
    --us-news-photo-motion: 320ms;
    --us-news-frame-ease: cubic-bezier(0.45, 0, 0.55, 1);
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] {
    --us-news-frame-width: 100%;
    --us-news-frame-height: var(--us-news-detail-hero-height);
    --us-news-frame-offset-y: 0px;
    --us-news-frame-radius-top-left: 180px;
    --us-news-frame-radius-rest: 16px;
    position: relative;
    align-self: flex-start;
    height: var(--us-news-detail-hero-height);
    min-height: var(--us-news-detail-hero-height);
    container-type: inline-size;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-frame-mode="graphic"] {
    --us-news-frame-radius-top-left: 16px;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news {
    width: 100% !important;
    height: var(--us-news-detail-hero-height) !important;
    min-height: var(--us-news-detail-hero-height) !important;
    margin: 0 !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    background: transparent;
    isolation: isolate;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news > .swiper-wrapper,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide {
    height: 100% !important;
    min-height: 100% !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 0.01;
    pointer-events: none;
    transition: opacity var(--us-news-photo-motion) ease-out !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news:not(.swiper-initialized) .swiper-slide:first-child,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide-active {
    opacity: 1;
    pointer-events: auto;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide > [data-news-frame-content="true"] {
    width: var(--us-news-slide-frame-width, var(--us-news-frame-width, 100%)) !important;
    height: var(--us-news-slide-frame-height, var(--us-news-frame-height, var(--us-news-detail-hero-height))) !important;
    min-height: 0 !important;
    margin-right: 0 !important;
    margin-left: auto !important;
    flex: 0 0 auto;
    transition: none !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] .swiper-slide {
    justify-content: center;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] .swiper-slide > [data-news-frame-content="true"] {
    margin-right: auto !important;
    margin-left: auto !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide > [data-news-frame-content="true"][data-news-frame-mode="photo"] {
    border-radius: 180px 16px 16px 16px !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide > [data-news-frame-content="true"][data-news-frame-mode="graphic"] {
    aspect-ratio: var(--us-news-slide-aspect-ratio);
    border-radius: 16px !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide > [data-news-frame-content="true"][data-news-frame-mode="graphic"] picture,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide > [data-news-frame-content="true"][data-news-frame-mode="graphic"] img {
    background: transparent;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .news-gallery-pagination {
    right: 0 !important;
    bottom: 24px !important;
    left: 0 !important;
    width: 100% !important;
    transform: none !important;
    transition: bottom var(--us-news-frame-motion) var(--us-news-frame-ease) !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"]:not([data-news-single-presentation="contain-surface"]) > .hero-slider-news .news-gallery-controls {
    top: calc(var(--us-news-detail-hero-height) - var(--us-news-frame-height) + 24px) !important;
    transition: top var(--us-news-frame-motion) var(--us-news-frame-ease) !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-wrapper,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news article,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news picture,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news img,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news button,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .news-gallery-pagination {
    -webkit-user-select: none;
    user-select: none;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news img {
    -webkit-user-drag: none;
}

@media (min-width: 768px) {
    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] {
        --us-news-frame-radius-top-left: 250px;
        --us-news-frame-radius-rest: 24px;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-frame-mode="graphic"] {
        --us-news-frame-radius-top-left: 24px;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news {
        background-color: #e8e4e0;
        -webkit-mask-image: linear-gradient(#000, #000);
        mask-image: linear-gradient(#000, #000);
        clip-path: inset(
            var(--us-news-frame-offset-y)
            0
            0
            calc(100% - var(--us-news-frame-width))
            round var(--us-news-frame-radius-top-left)
            var(--us-news-frame-radius-rest)
            var(--us-news-frame-radius-rest)
            var(--us-news-frame-radius-rest)
        );
        transition: clip-path var(--us-news-frame-motion) var(--us-news-frame-ease) !important;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide {
        align-items: flex-end;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide > [data-news-frame-content="true"][data-news-frame-mode] {
        border-radius: 0 !important;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] {
        clip-path: none;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] .swiper-slide > [data-news-frame-content="true"] {
        border-radius: 24px !important;
    }
}

@media (min-width: 1024px) {
    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] {
        --us-news-frame-radius-top-left: 300px;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-frame-mode="graphic"] {
        --us-news-frame-radius-top-left: 24px;
    }
}

@media (min-width: 1280px) {
    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-frame-mode="photo"][data-news-frame-orientation="portrait"] {
        --us-news-frame-width: min(100%, calc(var(--us-news-detail-hero-height) * 0.945));
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] {
        --us-news-frame-radius-top-left: 375px;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-frame-mode="graphic"] {
        --us-news-frame-radius-top-left: 24px;
    }
}

@media (min-width: 2400px) {
    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-frame-mode="photo"][data-news-frame-orientation="portrait"] {
        --us-news-frame-width: min(100%, calc(var(--us-news-detail-hero-height) * 1.13));
    }
}

@media (max-width: 767px) {
    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] {
        height: var(--us-news-frame-height);
        min-height: 0;
        margin-bottom: 0;
        overflow: hidden;
        border-radius:
            var(--us-news-frame-radius-top-left)
            var(--us-news-frame-radius-rest)
            var(--us-news-frame-radius-rest)
            var(--us-news-frame-radius-rest);
        background-color: #e8e4e0;
        transition:
            height var(--us-news-frame-motion) var(--us-news-frame-ease),
            border-radius var(--us-news-frame-motion) var(--us-news-frame-ease);
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide {
        align-items: flex-start;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .swiper-slide > [data-news-frame-content="true"][data-news-frame-mode] {
        width: 100% !important;
        border-radius: 0 !important;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .news-gallery-pagination {
        top: calc(var(--us-news-frame-height) - 24px) !important;
        bottom: auto !important;
        width: 100% !important;
        transition: top var(--us-news-frame-motion) var(--us-news-frame-ease) !important;
    }

    html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"] > .hero-slider-news .news-gallery-controls {
        top: 16px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html[data-understar-page-kind="news-detail"] {
        --us-news-frame-motion: 0ms;
        --us-news-photo-motion: 0ms;
    }
}

/*
 * A lone show-full graphic uses the same child-gallery principle as mixed news:
 * one stationary outer mask owns the shape, while Swiper and the image fill it.
 * Its source ratio is known in the initial HTML, so no 376px stage can flash or
 * remain centred inside a shorter square after the controller starts.
 */
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: auto;
    min-height: 0;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    aspect-ratio: auto;
    transition: none;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] {
    width: min(100%, calc(var(--us-news-detail-hero-height) * var(--us-news-single-source-ratio))) !important;
    height: auto !important;
    min-height: 0 !important;
    margin-right: auto !important;
    margin-left: auto !important;
    overflow: hidden !important;
    aspect-ratio: var(--us-news-single-source-aspect-ratio);
    clip-path: none !important;
    border-radius: var(--us-news-frame-radius-rest) !important;
    background: transparent !important;
    transition: none !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] > .swiper-wrapper,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] .swiper-slide,
html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] .swiper-slide > [data-news-frame-content="true"] {
    height: 100% !important;
    min-height: 0 !important;
}

html[data-understar-page-kind="news-detail"] [data-news-adaptive-frame="true"][data-news-single-presentation="contain-surface"] > .hero-slider-news[data-news-single-presentation="contain-surface"] .swiper-slide > [data-news-frame-content="true"] {
    width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    border-radius: 0 !important;
}
