/* Inline link with hover “preview” card (static HTML; no React LinkPreview). */
.link-preview {
    position: relative;
    display: inline-flex;
    vertical-align: baseline;
}

/*
 * Invisible hit target between the anchor and the floating card so :hover is not
 * lost in the gap (the card used pointer-events:none, so events passed through to
 * whatever was behind and unhovered the widget).
 */
.link-preview::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 14px;
    /* Below the card so the card (and its images) still receive hover */
    z-index: 1;
}

/* Lift the whole grid cell above siblings so the card is not covered by the next column/row */
.info-section .info-item:has(.link-preview:hover),
.info-section .info-item:has(.link-preview:focus-within) {
    position: relative;
    z-index: 12000;
}

.link-preview__anchor {
    color: var(--accent-color, #4289b2);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgba(66, 137, 178, 0.45);
    transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.link-preview__anchor:hover,
.link-preview__anchor:focus-visible {
    color: #5ba3cf;
    border-bottom-color: rgba(91, 163, 207, 0.85);
    outline: none;
    box-shadow: 0 2px 0 0 rgba(66, 137, 178, 0.35);
}

.link-preview__card {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: calc(100% + 12px);
    width: min(280px, 70vw);
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(22, 22, 22, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translate3d(-50%, 6px, 0) scale(0.96);
    transform-origin: 50% 100%;
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
    text-align: left;
}

.link-preview:hover .link-preview__card,
.link-preview:focus-within .link-preview__card {
    opacity: 1;
    transform: translate3d(-50%, 0, 0) scale(1);
    pointer-events: auto;
}

.link-preview__card::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: 10px;
    height: 10px;
    background: rgba(22, 22, 22, 0.96);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(-50%) rotate(45deg);
}

.link-preview__thumb {
    display: block;
    width: 100%;
    height: 132px;
    object-fit: cover;
    object-position: center top;
    background: #141414;
}

/* Wide logos (e.g. DBGA) — keep full mark readable */
.link-preview__thumb--logo {
    object-fit: contain;
    padding: 0.65rem 1rem;
    background: #0f0f0f;
}

.link-preview__body {
    display: block;
    padding: 0.75rem 0.85rem;
}

.link-preview__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.link-preview__favicon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
}

.link-preview__domain {
    font-family: var(--font-main, system-ui, sans-serif);
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(224, 224, 224, 0.65);
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-preview__title {
    display: block;
    font-family: var(--font-heading, system-ui, sans-serif);
    font-size: 0.95rem;
    font-weight: 700;
    color: #f2f2f2;
    line-height: 1.25;
    margin-bottom: 0.25rem;
}

.link-preview__hint {
    font-family: var(--font-main, system-ui, sans-serif);
    font-size: 0.72rem;
    color: rgba(224, 224, 224, 0.5);
}

@media (prefers-reduced-motion: reduce) {
    .link-preview__card {
        transition: opacity 0.15s ease;
        transform: translate3d(-50%, 0, 0) scale(1);
    }

    .link-preview:hover .link-preview__card,
    .link-preview:focus-within .link-preview__card {
        transform: translate3d(-50%, 0, 0) scale(1);
    }
}
