/**
 * Overlay dialog (modalBox)
 * Show/hide behavior ro-relations-cards.js
 */

:root {
    --radius: var(--pbui-radius, .8em);
}

.ro-relations__overlay {
    width: 95dvw;
    max-width: 55em;
    padding: 0;
    border: 0;
    font-size: 1rem;
    box-shadow: var(--pbui-shadow, 0 10px 10px -10px rgb(0 0 0 / 20%));
}

.ro-relations__overlay {
    .ro-relations__overlayToggle--open {
        pointer-events: none;
    }

    .ro-relations__overlayToggle--close {
        position: sticky;
        top: 0;
        left: calc(100% - 1em);
        z-index: +1;
        margin: 0;
        padding: .5em .9em;
        border: 0;
        border-radius: 0;
        font-size: 1em;
        line-height: 1;
        background: #fff !important;
        box-shadow: none;
    }

    .ro-relations__overlayToggle .icon {
        width: 1.5ch;
        border-radius: 0;
        pointer-events: none;
    }

    .ro-relations__overlayToggle span {
        position: absolute;
        left: -999em;
    }

    & button {
        transform: none !important;
    }
}

/**
 * Content
 */

.ro-relations__overlayWrapper {
    margin-top: -2.5em;/** close button pushes wrapper down */

    & > *:has(*) {
        margin-bottom: 0;
        padding: var(--pbui-space, 1em);
    }

    & [class*='__figure'] {
        background-color: var(--primaryColor100, #f2f2f2);
    }

    & [class*='__itemTitle'] {
        font-size: var(--h3Size, 1.5rem);
    }

    & [class*='__wrapper'] {
        display: block;
    }

    & [class*='__wrapper'] > * + * {
        margin-top: 1rem;
    }
}

@media (min-width: 35em) {
    .ro-relations__overlayWrapper {
        display: grid;
        grid-template-columns: min(276px, 50%) calc(100% - min(276px, 50%)) auto;
    }
}

/* Fill empty grid column with color when there is no image and no link to detailPage */
.ro-relations__overlayWrapper:not(:has([class*='__figure']))::before {
    content: '';
    background-color: var(--primaryColor100, #f2f2f2);
}

.ro-relations__overlay * + [class*='__detailPage'] {
    margin-top: var(--pbui-space, 1em);
}

/**
 * Oval images
 */

.ro-relations--oval .ro-relations__overlay {
    border-radius: calc(var(--radius) * 1.5);
}
