/* Page teaser – native CSS with nesting */

.content-teaser-element { overflow: visible; }

.ce_teaser_container > .inside {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    transition: transform 0.25s ease-in-out;

    .ce_teaser_wrapper {
        padding: 20px;
        max-width: var(--teaser_max_width, 33.33%);
        min-width: var(--teaser_min_width, 300px);

        @media (max-width: 1023px) {
            width: calc(100% / 3) !important;
            max-width: 412px !important;
            padding: 10px;
        }

        @media (max-width: 767px) {
            width: calc(100% / 2) !important;
            max-width: 412px !important;
            padding: 10px;
        }

        & > .inside {
            position: relative;
            width: 100%;
            height: 100%;
            transition: scale 0.25s ease-in-out;

            &:hover { scale: 1.02; }
        }

        .ce_teaser_item {
            display: flex;
            flex-wrap: wrap;
            align-content: flex-start;
            height: 100%;
            border: 1px solid #ddd;
            padding-bottom: 20px;
            background: #fff;
            text-align: center;

            img {
                width: 100%;
                aspect-ratio: 1.9;
                object-fit: cover;
            }

            &:hover { text-decoration: none; }

            .text {
                padding: 20px 20px 0 20px;
                width: 100%;

                @media (max-width: 1023px) { padding: 30px 30px 0 10px; }

                h2 {
                    margin-top: 0;

                    @media (max-width: 1300px) { font-size: 16px; }
                }

                p { color: #444; margin-bottom: 35px; }
            }

            .link {
                text-align: right;
                padding-right: 30px;
                position: absolute;
                right: 0;
                bottom: 20px;
            }
        }
    }
}

/* Site-specific alternating card backgrounds (kept for backwards compatibility;
   ideally these live in the theme, not the bundle). */
.abg1 .mod_article:nth-child(odd) .ce_teaser_container .inside .ce_teaser_wrapper .ce_teaser_item { background: #fff; }
.abg1 .mod_article:nth-child(even) .ce_teaser_container .inside .ce_teaser_wrapper .ce_teaser_item { background: #f8f8f8; }

.abg2 .mod_article:nth-child(odd) .ce_teaser_container .inside .ce_teaser_wrapper .ce_teaser_item { background: #f8f8f8; }
.abg2 .mod_article:nth-child(even) .ce_teaser_container .inside .ce_teaser_wrapper .ce_teaser_item { background: #fff; }

#wrapper .mod_article.HintergrundWeiß .ce_teaser_container .inside .ce_teaser_wrapper .ce_teaser_item { background: #f8f8f8; }
#wrapper .mod_article.HintergrundGrau .ce_teaser_container .inside .ce_teaser_wrapper .ce_teaser_item { background: #fff; }

#container > #main > .inside > .ce_teaser_container {
    border-bottom: 1px solid #ddd;

    & > .inside {
        margin: auto;
        padding: 60px 0;
        max-width: 1600px;
    }
}

/* in-viewport fade/slide-in animation */
.ivp { overflow: visible; }

.ce_teaser_container.ivp > .inside > .ce_teaser_wrapper {
    opacity: 0;
    top: 100px;
    position: relative;
}

.ce_teaser_container.wivp > .inside > .ce_teaser_wrapper {
    opacity: 1;
    top: 0;
    transition: opacity 2s ease-in-out, top 1.5s ease-in-out;
    --duration: 0.25s;

    &:nth-child(1)  { transition-delay: calc(1  * var(--duration)); }
    &:nth-child(2)  { transition-delay: calc(2  * var(--duration)); }
    &:nth-child(3)  { transition-delay: calc(3  * var(--duration)); }
    &:nth-child(4)  { transition-delay: calc(4  * var(--duration)); }
    &:nth-child(5)  { transition-delay: calc(5  * var(--duration)); }
    &:nth-child(6)  { transition-delay: calc(6  * var(--duration)); }
    &:nth-child(7)  { transition-delay: calc(7  * var(--duration)); }
    &:nth-child(8)  { transition-delay: calc(8  * var(--duration)); }
    &:nth-child(9)  { transition-delay: calc(9  * var(--duration)); }
    &:nth-child(10) { transition-delay: calc(10 * var(--duration)); }
    &:nth-child(11) { transition-delay: calc(11 * var(--duration)); }
    &:nth-child(12) { transition-delay: calc(12 * var(--duration)); }
    &:nth-child(13) { transition-delay: calc(13 * var(--duration)); }
    &:nth-child(14) { transition-delay: calc(14 * var(--duration)); }
    &:nth-child(15) { transition-delay: calc(15 * var(--duration)); }
    &:nth-child(16) { transition-delay: calc(16 * var(--duration)); }
    &:nth-child(17) { transition-delay: calc(17 * var(--duration)); }
    &:nth-child(18) { transition-delay: calc(18 * var(--duration)); }
    &:nth-child(19) { transition-delay: calc(19 * var(--duration)); }
    &:nth-child(20) { transition-delay: calc(20 * var(--duration)); }
}
