/* BG-Wiki item hover preview ----------------------------------------
 *
 * Item names in generated tables are rendered as <a class="item-link">
 * pointing at the BG-Wiki article, carrying a `data-img` attribute with
 * the description image URL. JS shows the image as a floating tooltip
 * on hover (desktop) or tap (touch). */

.item-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    cursor: help;
}

.item-link:hover,
.item-link:focus {
    color: var(--md-accent-fg-color, #3f51b5);
    text-decoration: none;
    border-bottom-color: currentColor;
}

#item-tooltip {
    position: absolute;
    z-index: 1000;
    display: none;
    pointer-events: none;
    padding: 6px;
    background: var(--md-default-bg-color, #fff);
    border: 1px solid var(--md-default-fg-color--lightest, rgba(0, 0, 0, 0.1));
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    max-width: 480px;
}

#item-tooltip.is-loading::before {
    content: "Loading…";
    display: block;
    padding: 8px 12px;
    font-size: 0.85em;
    color: var(--md-default-fg-color--light, #666);
}

#item-tooltip img {
    display: block;
    max-width: 100%;
    max-height: 480px;
    height: auto;
}

/* On touch devices we want the tooltip itself to be tappable so the
 * user can dismiss it. On hover-only devices it stays click-through. */
@media (hover: none) {
    #item-tooltip {
        pointer-events: auto;
    }

    #item-tooltip::after {
        content: "Tap to close";
        display: block;
        padding: 4px 8px 2px;
        font-size: 0.75em;
        color: var(--md-default-fg-color--light, #888);
        text-align: center;
    }
}
