/* Consecutive profile frames in one Nitsan/Bootstrap column become a grid.
   Tracks are 6rem. Medium spans three tracks (about the previous 17.5rem card),
   small spans two, large spans four. Narrow columns stack the cards. */
:is(.col, [class*="col-"]):has(> :is(.frame-type-kfuaccessibility_vertretungsprofil, .frame-type-kfuaccessibility_kontakt)) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 6rem), 1fr));
    gap: 1.25rem;
    align-items: stretch;
    container-type: inline-size;
    container-name: kfu-profiles;
}

:is(.col, [class*="col-"]):has(> :is(.frame-type-kfuaccessibility_vertretungsprofil, .frame-type-kfuaccessibility_kontakt)) > :not(.frame-type-kfuaccessibility_vertretungsprofil, .frame-type-kfuaccessibility_kontakt) {
    grid-column: 1 / -1;
}

.frame-type-kfuaccessibility_vertretungsprofil {
    margin: 0;
    min-width: 0;
    height: auto;
    grid-column: span 3;
}

.frame-type-kfuaccessibility_kontakt {
    margin: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    grid-column: 1 / -1;
}

/* Container columns without a Bootstrap width still share the row, and the card fills that column. */
.row > div:not([class*="col"]):has(> .frame-type-kfuaccessibility_kontakt) {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

@media (min-width: 768px) {
    .row > div:not([class*="col"]):has(> .frame-type-kfuaccessibility_kontakt) {
        flex: 1 1 0;
        width: auto;
    }
}

.frame-type-kfuaccessibility_vertretungsprofil.kfu-card--small {
    grid-column: span 2;
}

.frame-type-kfuaccessibility_vertretungsprofil.kfu-card--large {
    grid-column: span 4;
}

@container kfu-profiles (max-width: 36rem) {
    .frame-type-kfuaccessibility_vertretungsprofil,
    .frame-type-kfuaccessibility_vertretungsprofil.kfu-card--small,
    .frame-type-kfuaccessibility_vertretungsprofil.kfu-card--large {
        grid-column: 1 / -1;
    }
}

@container kfu-profiles (min-width: 36rem) and (max-width: 52rem) {
    .frame-type-kfuaccessibility_vertretungsprofil.kfu-card--large {
        grid-column: span 3;
    }
}

.kfu-vertretung {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}

.kfu-vertretung:hover,
.kfu-vertretung:focus-within {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.kfu-vertretung-link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    color: inherit;
    text-decoration: none;
}

.kfu-vertretung-link:hover,
.kfu-vertretung-link:focus {
    color: inherit;
    text-decoration: none;
}

/* Nitsan paints headings inside a hovered link with #0d6efd. */
.kfu-vertretung-link:hover :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4, .card-title),
.kfu-vertretung-link:focus :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4, .card-title) {
    color: var(--bs-heading-color, var(--text-color, inherit));
}

.kfu-kontakt-mail,
.kfu-vertretung-link:hover .kfu-kontakt-mail,
.kfu-vertretung-link:focus .kfu-kontakt-mail {
    color: var(--primary-color, var(--bs-link-color, #0d6efd));
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.kfu-vertretung-link:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

.kfu-vertretung .kfu-vertretung-media,
.kfu-vertretung .kfu-vertretung-placeholder {
    display: block;
    width: 100%;
    margin: 0;
    background: transparent;
    border: 0;
}

.kfu-vertretung .kfu-vertretung-media {
    height: auto;
    object-fit: contain;
    border-bottom: var(--bs-card-border-width, 1px) solid var(--bs-card-border-color, rgba(0, 0, 0, 0.175));
}

.kfu-vertretung .kfu-vertretung-placeholder {
    aspect-ratio: 4 / 3;
}

.kfu-vertretung-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

.kfu-vertretung-actions {
    position: relative;
    z-index: 2;
}

.kfu-vertretung-actions a {
    position: relative;
    z-index: 2;
    color: var(--primary-color, var(--bs-link-color, #0d6efd));
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.kfu-vertretung-actions a:hover,
.kfu-vertretung-actions a:focus-visible {
    color: var(--text-color, var(--bs-link-hover-color, #0a58ca));
}

.kfu-vertretung-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bs-secondary-bg, #f8f9fa);
    color: var(--primary-color, var(--bs-link-color, #0d6efd));
    text-decoration: none;
}

.kfu-vertretung-social a:hover,
.kfu-vertretung-social a:focus-visible {
    color: var(--text-color, var(--bs-link-hover-color, #0a58ca));
}

/* Five classless container columns stay five equal tracks on a wide screen. */
.frame-type-ns_base_5Cols > .row {
    row-gap: 1rem;
}

.frame-type-ns_base_5Cols > .row > div {
    min-width: 0;
}

.frame-type-ns_base_5Cols > .row > div:not([class*="col"]) {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .frame-type-ns_base_5Cols > .row > div:not([class*="col"]) {
        flex: 0 0 50%;
        width: 50%;
        max-width: 50%;
    }
}

@media (min-width: 1200px) {
    .frame-type-ns_base_5Cols > .row > div:not([class*="col"]) {
        flex: 0 0 20%;
        width: 20%;
        max-width: 20%;
    }
}

.frame-type-ns_base_5Cols .frame-type-kfuaccessibility_kontakt + .frame-type-kfuaccessibility_kontakt {
    margin-top: 1rem;
}

.kfu-kontakt .card-title,
.kfu-kontakt-mail {
    overflow-wrap: anywhere;
}
