/**
 * Image preview on hover (js/helpers/image-preview.js): a larger cover next to the finder results (and the
 * calendar agenda) while the pointer is on a thumbnail, with the item's name as the caption. The script sets
 * top and left beside the list. Semantic tokens of layout-site/master.css; hidden on touch screens.
 */

.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.image-preview-overlay.active {
    opacity: 1;
}

.image-preview-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
    padding: 8px 8px 10px;
    border-radius: var(--radius);
    background: var(--surface-1);
    box-shadow: inset 0 0 0 1px var(--line-strong), 0 24px 60px -12px rgba(0, 0, 0, 0.85);
    animation: preview-slide-in 0.2s ease-out;
}

.image-preview-container img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 460px;
    border-radius: 8px;
    object-fit: contain;
}

.image-preview-label {
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: var(--text-1);
}

.image-preview-label:empty {
    display: none;
}

@keyframes preview-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .image-preview-container {
        max-width: 260px;
    }

    .image-preview-container img {
        max-height: 380px;
    }
}

/* No hover on touch screens */
@media (hover: none) {
    .image-preview-overlay {
        display: none;
    }
}
