/*
 * Base styles of the company list and its detail popup (plugin pbjobportal_companylist).
 * Kept minimal on purpose, the design is done in the sitepackage.
 */
.c-company-list {
    --company-list-red: #e40422;
    --company-list-radius: 1.4rem;
}

/* headline of the text element right before the company list ("Companies"): black instead of the theme red */
.frame:has(+ .frame .c-company-list) .element-header {
    color: #1a1a1a;
}

/* 5 cards per row, 3 on small screens */
.c-company-list__items {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.c-company-list__item {
    margin: 0;
}

.c-company-list__link {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    aspect-ratio: 6 / 5;
    overflow: hidden;
    border-radius: var(--company-list-radius);
    background: #fff;
    color: inherit;
    text-decoration: none;
}

.c-company-list__link:hover,
.c-company-list__link:focus-visible {
    color: inherit;
    box-shadow: 0 .4rem 1.4rem rgba(0, 0, 0, .1);
}

/* top job partner: red tab "Berlin Partner" */
.c-company-list__badge {
    flex: 0 0 auto;
    padding: .35rem .5rem;
    background: var(--company-list-red);
    color: #fff;
    font-size: .875rem;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
}

.c-company-list__logo {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 1rem 1.5rem 2.25rem;
}

.c-company-list__logo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.c-company-list__logo-placeholder {
    font-weight: bold;
    text-align: center;
}

/* round "+" button: opens the detail popup */
.c-company-list__link::after {
    content: "";
    position: absolute;
    right: .85rem;
    bottom: .85rem;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: #dcdcdc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3.5v9M3.5 8h9' stroke='%231a1a1a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / .8rem;
    transition: background-color .15s ease;
}

.c-company-list__link:hover::after,
.c-company-list__link:focus-visible::after {
    background-color: var(--company-list-red);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3.5v9M3.5 8h9' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.c-company-list__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* load more */
.c-company-list__more {
    margin-top: 3.5rem;
    text-align: center;
}

.c-company-list__load-more {
    display: inline-block;
    padding: .75rem 1.6rem;
    border-radius: 2rem;
    background: #dcdcdc;
    color: #1a1a1a;
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    text-transform: uppercase;
}

.c-company-list__load-more:hover,
.c-company-list__load-more:focus-visible {
    background: #cfcfcf;
    color: #1a1a1a;
}

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

@media (max-width: 991.98px) {
    .c-company-list__items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }

    .c-company-list__logo {
        padding: .75rem 1rem 2rem;
    }
}

@media (max-width: 575.98px) {
    .c-company-list__items {
        gap: .6rem;
    }

    .c-company-list {
        --company-list-radius: 1rem;
    }

    .c-company-list__badge {
        font-size: .6875rem;
        padding: .25rem .3rem;
    }

    .c-company-list__logo {
        padding: .5rem .6rem 1.6rem;
    }

    .c-company-list__link::after {
        right: .4rem;
        bottom: .4rem;
        width: 1.4rem;
        height: 1.4rem;
        background-size: .65rem;
    }
}

.c-company-popup {
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    padding: 2rem;
    border: 0;
    border-radius: .5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .3);
}
.c-company-popup::backdrop {
    background: rgba(0, 0, 0, .5);
}
.c-company-popup__close {
    position: absolute;
    top: .5rem;
    right: .75rem;
    border: 0;
    background: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}
.c-popup-company__image {
    margin-bottom: 1rem;
}
.c-popup-company__image img {
    max-width: 100%;
    height: auto;
}
.c-popup-company__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}
html.has-company-popup {
    overflow: hidden;
}
