/* Work listing ONLY. Reserve the image/video frame before Vimeo is created. */
.work-listing .project-hover.work-managed-video {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: var(--work-video-aspect, 16 / 9);
    overflow: hidden;
    isolation: isolate;
}

/* The poster always fills that fixed frame, even before the file decodes. */
.work-listing .project-hover.work-managed-video > img.vimeo-poster {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    z-index: 2;
    opacity: 1;
    pointer-events: none;
    transition: opacity .25s ease;
}

/* Injected by if-work-videos.js only when the card approaches the viewport. */
.work-listing .project-hover.work-managed-video > iframe.work-vimeo-iframe {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    z-index: 1;
    pointer-events: none; /* The entire card remains a link. */
}

.work-listing .project-hover.work-managed-video.is-playing > img.vimeo-poster {
    opacity: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
    .work-listing .project-hover.work-managed-video > img.vimeo-poster {
        transition: none;
    }
}

/* Full-width Work projects — crop Vimeo to fill the frame */
.work-listing .fullwidth-proj .work-managed-video > iframe.work-vimeo-iframe {
    position: absolute !important;

    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;

    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 2 !important;

    transform: translate(-50%, -50%) !important;

    border: 0;
}