.wrapper-link-image {
    width: 100%;
    display: flex;
    flex-direction: row;
}

.link-wrapper {
    position: relative;
    display: flex;
    flex: 1 1 0%;
    min-width: 0;
    min-height: 600px;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 40px;
    overflow: hidden;
    cursor: pointer;
}

.link-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.2) 100%);
    z-index: 2;
}

.link-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.link-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    padding: 20px;
    background-color: var(--wp--preset--color--dark);
    border-radius: 20px;
    opacity: 1;
    visibility: visible;
    /* FIX Safari: ajouter une transition stable */
    transition: opacity .3s ease-in-out, visibility .3s ease-in-out;
}

.link-content h3 {
    color: var(--wp--preset--color--light) !important;
}

.link-content p {
    color: var(--wp--preset--color--light) !important;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    line-clamp: 1;
    -webkit-line-clamp: 1;
    overflow: hidden;
}


.link-wrapper svg {
    position: absolute;
    top: 40px;
    left: 40px;
    opacity: 0;
    z-index: 3;
}

@media (min-width: 1025px) {
    .link-wrapper {
        transition: flex-grow .3s ease-in-out, flex-basis .3s ease-in-out;
    }

    .wrapper-link-image:has(.link-wrapper:hover) .link-wrapper {
        flex: 0.4 1 0%;
    }

    .link-wrapper:hover {
        flex: 4 1 0% !important;
    }

    .wrapper-link-image:has(.link-wrapper:hover) .link-wrapper:not(:hover) .link-content {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .1s ease-in-out, visibility .1s ease-in-out;
    }

    /* FIX Safari: ne pas changer display / clamp globalement ici */
    .link-wrapper:hover .link-content {
        /* on laisse display:flex, on ne touche qu’à l’opacité/visibilité */
        opacity: 1;
        visibility: visible;
        transition: opacity .6s ease-in-out, visibility .6s ease-in-out;
    }

    /* FIX Safari: on augmente seulement le clamp du paragraphe sur hover */
    .link-wrapper:hover .link-content>p {
        line-clamp: 4;
        -webkit-line-clamp: 4;
        overflow: hidden;
    }

    .link-wrapper:hover svg {
        opacity: 1;
        transition: opacity .3s ease-in-out;
    }
}

@media not all and (min-width: 1025px) {
    .link-wrapper {
        width: 100%;
        min-height: 450px;
    }

    .wrapper-link-image {
        flex-direction: column !important;
    }

    .link-content p {
        text-overflow: clip;
        display: block;
        line-clamp: unset;
        -webkit-line-clamp: unset;
        overflow: visible;
    }
}

@media not all and (min-width: 641px) {
    .link-wrapper {
        padding: 20px;
    }
}