/*
 * News list "Success Story" (Partials/News/SuccessStoryList.html), layout after the designer's draft:
 * light blue cards with title and teaser, image alternately right and left, arrow button on the image,
 * "load more" button below.
 * The intro (textmedia element directly before the list plugin) gets its title above the image and a centered text.
 */
.c-storylist {
    --storylist-width: 51rem;
    --storylist-card: #accae5;
    --storylist-radius: 1.75rem;
    --storylist-text: #1a1a1a;
    margin: 0 auto;
    max-width: var(--storylist-width);
}

/* intro: title, image, text (only the textmedia element right before the success story list) */
.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 auto;
    max-width: 51rem;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-text {
    display: contents;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .frame-header {
    order: -1;
    margin: 0 0 2rem;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .frame-header .element-header {
    margin: 0;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .element-header {
    color: var(--bs-primary, #e40422);
    font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.4rem);
    font-weight: bold;
    text-align: center;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-gallery {
    order: 1;
    margin: 0;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-gallery .gallery-row,
.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-gallery .gallery-item,
.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-gallery figure {
    margin: 0;
    padding: 0;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-text > :not(.frame-header) {
    order: 2;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-gallery img {
    width: 100%;
    height: auto;
    border-radius: 1.25rem;
}

.frame-type-textmedia:has(+ .frame-type-news_newsliststicky .c-storylist) .textmedia-text p {
    margin: 1.5rem auto 0;
    max-width: 47rem;
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
}

/* cards */
.c-storylist__items {
    display: grid;
    gap: 2rem;
}

.c-storylist__item {
    margin: 0;
}

.c-storylist__link {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
    border-radius: var(--storylist-radius);
    background: var(--storylist-card);
    color: var(--storylist-text);
    text-decoration: none;
}

.c-storylist__link:hover,
.c-storylist__link:focus-visible {
    color: var(--storylist-text);
}

.c-storylist__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1.875rem;
}

.c-storylist__title {
    display: block;
    margin-bottom: 1.25rem;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1.3;
}

.c-storylist__link:hover .c-storylist__title,
.c-storylist__link:focus-visible .c-storylist__title {
    text-decoration: underline;
}

.c-storylist__teaser {
    display: block;
    font-size: 1rem;
    line-height: 1.65;
}

.c-storylist__image {
    position: relative;
    display: block;
    order: -1;
    min-height: 16rem;
    overflow: hidden;
    border-radius: var(--storylist-radius);
    background: #dfe9f3;
}

.c-storylist__image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* round arrow button on the image */
.c-storylist__image::after {
    content: "";
    position: absolute;
    top: .9rem;
    right: .9rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5.5 2.5 11 8l-5.5 5.5' fill='none' stroke='%231a1a1a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 1rem;
    transition: transform .15s ease;
}

.c-storylist__link:hover .c-storylist__image::after,
.c-storylist__link:focus-visible .c-storylist__image::after {
    transform: translateX(.2rem);
}

@media (min-width: 768px) {
    .c-storylist__link {
        grid-template-columns: minmax(0, 1fr) minmax(0, .87fr);
        min-height: 23.5rem;
    }

    .c-storylist__image {
        order: 0;
        min-height: 0;
    }

    /* every second card: image left */
    .c-storylist__item:nth-child(even) .c-storylist__link {
        grid-template-columns: minmax(0, .87fr) minmax(0, 1fr);
    }

    .c-storylist__item:nth-child(even) .c-storylist__image {
        order: -1;
    }
}

/* load more */
.c-storylist__more {
    margin-top: 2rem;
    text-align: center;
}

.c-storylist__load-more {
    display: inline-block;
    padding: .55rem 1.25rem;
    border-radius: 2rem;
    background: #e5e5e5;
    color: var(--storylist-text);
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    text-transform: uppercase;
}

.c-storylist__load-more:hover,
.c-storylist__load-more:focus-visible {
    background: #d6d6d6;
    color: var(--storylist-text);
}

.c-storylist__load-more.loading {
    opacity: .5;
    pointer-events: none;
}

/* colour variant "green": news folders Growing companies (191) and Job events (201) */
.c-storylist--folder-191,
.c-storylist--folder-201,
.c-storyteaser--folder-191 .c-storylist,
.c-storyteaser--folder-201 .c-storylist {
    --storylist-card: #9bcfae;
}
